how could monitor device status using raspberry pi

Question!

I want to build a small project which will monitor some devices(pump,ac etc) status(on/off, current/voltage level etc). I have decided to use raspberry pi 3 as a server. I am thinking about scada. is it efficient to do these works? also i am not familiar to scada. is there anyone to guide me--

 where should i start? 
 what is the suitable software for doing it?? 
By : Akash Nil


Answers

You could just use Python and the RPi.GPIO module to control and monitor the GPIO pins on the Raspberry. Python is powerful, open-script and easy to get into.

You would need to develop a bread-board to protect your Raspberry and allow for monitoring higher voltages.

Some example code on using GPIO with Sockets here: https://github.com/matzpersson/raspberry-gpio-sockets

By : Matz



Uou can use below syntax to get your answer.

select sum(cast(columnname as int)) from TableName

Try applying this syntax,

select sum(cast(s.MA as int)) from (
Select
 RVU.Name,RVU.No,VV.Model,count(VV.Model) as total, RVU.MA as MA,RVU.Speed 
from 
 VV 
inner join RVU
on VV.MID=RVU.ID 
inner join RU on RVU.RID= RU.RID
WHERE 
RU.StartDate>= '2016-04-01 00:00:00' and
 RU.EndDate<='2016-04-30 23:59:59'   and
RU.Region= 'Paris'
and RVU.No= '651' AND Model <> ''
Group By RVU.Name,RVU.RegNo,VV.Model,RVU.MA,RVU.Speed ) S

Check this query, whether you were able to select your record and apply this logic in your query.

Your final query looks like,

Select 
S.Name,S.No,
SUM(Case when s.Model='Cultus' then total else 0 end) as Cultus,
SUM(Case when s.Model ='vigo' then total else 0 end) as vigo,
SUM(total) total_v ,
sum(cast(s.MA as int)),MAX(S.Speed) Speed
from (
Select
RVU.Name,RVU.No,VV.Model,count(VV.Model) as total, RVU.MA as MA,RVU.Speed 
from 
VV 
inner join RVU
on VV.MID=RVU.ID 
inner join RU on RVU.RID= RU.RID
WHERE 
RU.StartDate>= '2016-04-01 00:00:00' and
RU.EndDate<='2016-04-30 23:59:59'   and
RU.Region= 'Paris'
and RVU.No= '651' AND Model <> ''
Group By RVU.Name,RVU.RegNo,VV.Model,RVU.MA,RVU.Speed ) S
GROUP BY
s.RegNo,s.Name,S.MA


There may be a chance of string value in the column RVU.MA. Try out with the below query to find out such descrepancies.

   SELECT *
   FROM RVU
   WHERE ISNUMERIC (RVU.MA)!=1


This video can help you solving your question :)
By: admin