RPIEasy

Moderators: grovkillen, TD-er, Stuntteam

Message
Author
Alan-rpi
Normal user
Posts: 15
Joined: 09 Feb 2020, 22:49
Location: UK

Re: RPIEasy

#201 Post by Alan-rpi » 17 Feb 2020, 00:16

budman1758 wrote:
16 Feb 2020, 18:15
There is a way to send text to your phone via email. See this web page for detail.
https://www.digitaltrends.com/mobile/ho ... l-account/
I've used this before. Seems to work ok.
Thanks for that. I'll add them to my list of potential gateways though I note they are mostly US.
Alan in the UK
RPi 4 (Rasp 10 Buster Lite 4.19.93-v71 +Asterisk 16.6.1 +FreePBX 15.0.16.22) image on SSD
Added LXDE desktop, TightVNCserver, Python3, RPI Easy, Docker+OpenHAB+Mosquitto
Using for home auto inc: Asterisk PABX, Alarms, Lights, Doors, Alerts

Alan-rpi
Normal user
Posts: 15
Joined: 09 Feb 2020, 22:49
Location: UK

Re: RPIEasy

#202 Post by Alan-rpi » 18 Feb 2020, 21:58

Hi. I'm now defining a full trial.
I have some output relays and I know my rule can be

Code: Select all

gpio, 13, 1	
but it would be nice to give the output GPIOs names like the inputs.
I was hoping one could then say for example

Code: Select all

if [PanelAlarmSet#state] = 1
           gpio, [DoorLock#state], 1  
or maybe  gpio, [DoorLock], 1  
or maybe  [DoorLock] = 1
endif 
To do this it must be possible to define DoorLock as a Device. Types could be Relay or Switch or LED or an all embracing OnOff Device.

What do you think/suggest.
Alan in the UK
RPi 4 (Rasp 10 Buster Lite 4.19.93-v71 +Asterisk 16.6.1 +FreePBX 15.0.16.22) image on SSD
Added LXDE desktop, TightVNCserver, Python3, RPI Easy, Docker+OpenHAB+Mosquitto
Using for home auto inc: Asterisk PABX, Alarms, Lights, Doors, Alerts

User avatar
enesbcs
Normal user
Posts: 479
Joined: 18 Jun 2017, 11:02
Location: Békéscsaba, Hungary
Contact:

Re: RPIEasy

#203 Post by enesbcs » 18 Feb 2020, 23:10

Alan-rpi wrote:
18 Feb 2020, 21:58
but it would be nice to give the output GPIOs names like the inputs.
There is an existing Output helper plugin, that can be used for a similar manner.
https://github.com/enesbcs/rpieasy/blob ... oOutput.py
If you define one, you can change its state with "taskvalueset,tasknumber,valuenumber,state" and the Value name will hold its actual state. I guess i can enhance "taskvalueset" command to accept [taskname#valuename] for lazy coders who struggle with numbers.
Alan-rpi wrote:
18 Feb 2020, 21:58
What do you think/suggest.
I think you have never used ESPEasy before. :)

Alan-rpi
Normal user
Posts: 15
Joined: 09 Feb 2020, 22:49
Location: UK

Re: RPIEasy

#204 Post by Alan-rpi » 18 Feb 2020, 23:29

Hi. I note that ESP8266 system has System#Wake and System#Boot. Do these work with RPi Easy and is there a System command for closedown/stopping?

On the matter of closedown. If I run RPi Easy as a system task then is RPi Easy happy to be stopped via the Shutdown Now command?

I have written a closedown script where I stop other system tasks such as databases so I could issue stop rpieasy if there was such a command.

Alan
Alan in the UK
RPi 4 (Rasp 10 Buster Lite 4.19.93-v71 +Asterisk 16.6.1 +FreePBX 15.0.16.22) image on SSD
Added LXDE desktop, TightVNCserver, Python3, RPI Easy, Docker+OpenHAB+Mosquitto
Using for home auto inc: Asterisk PABX, Alarms, Lights, Doors, Alerts

User avatar
enesbcs
Normal user
Posts: 479
Joined: 18 Jun 2017, 11:02
Location: Békéscsaba, Hungary
Contact:

Re: RPIEasy

#205 Post by enesbcs » 19 Feb 2020, 07:07

Alan-rpi wrote:
18 Feb 2020, 23:29
Hi. I note that ESP8266 system has System#Wake and System#Boot. Do these work with RPi Easy and is there a System command for closedown/stopping?

On the matter of closedown. If I run RPi Easy as a system task then is RPi Easy happy to be stopped via the Shutdown Now command?
Yes "shutdown now" can be used. But you can also use Tools/Halt command, or "halt" in URL/Rules.
System#Boot called after rules init section in RPIEasy.py and System#Shutdown called at stopping. But this information can be obtained when you look at debug logs.

Alan-rpi
Normal user
Posts: 15
Joined: 09 Feb 2020, 22:49
Location: UK

Re: RPIEasy

#206 Post by Alan-rpi » 19 Feb 2020, 12:57

enesbcs wrote:
18 Feb 2020, 23:10
for lazy coders who struggle with numbers.
Quite the opposite, I struggle with words! It's about writing code that is descriptive. With numbers one has to either keep commenting what the GPIO x represents or keep looking up what x represents or trying to remember what x represents.

Once my code is written and working it may not be looked at for months, so when I do come back to it then words will get me up to speed quicker.
Yes "shutdown now" can be used. But you can also use Tools/Halt command, or "halt" in URL/Rules.
System#Boot called after rules init section in RPIEasy.py and System#Shutdown called at stopping
Thanks for clarifying the existance of the rules halt command. It is not mentioned on the Commands page https://www.letscontrolit.com/wiki/inde ... O#Commands
There is an existing Output helper plugin, that can be used for a similar manner.
I saw that but couldn't quite figure out how to use it and I was a bit put off using something called Domoticz rather than Relay or Switch. I will look again.

I now see that Domoticz is another HA system. Maybe I should look at that!!! I see it has Zigbee support - useful to control my Hue lights - I don't like the Philips App.

Thanks
Alan
Alan in the UK
RPi 4 (Rasp 10 Buster Lite 4.19.93-v71 +Asterisk 16.6.1 +FreePBX 15.0.16.22) image on SSD
Added LXDE desktop, TightVNCserver, Python3, RPI Easy, Docker+OpenHAB+Mosquitto
Using for home auto inc: Asterisk PABX, Alarms, Lights, Doors, Alerts

User avatar
enesbcs
Normal user
Posts: 479
Joined: 18 Jun 2017, 11:02
Location: Békéscsaba, Hungary
Contact:

Re: RPIEasy

#207 Post by enesbcs » 19 Feb 2020, 17:49

Alan-rpi wrote:
19 Feb 2020, 12:57
Thanks for clarifying the existance of the rules halt command. It is not mentioned on the Commands page https://www.letscontrolit.com/wiki/inde ... O#Commands
Yes, as the ESP8266 has no real shutdown function, but Raspberry Pi has, so i've added it.
https://github.com/enesbcs/rpieasy/wiki ... mmand-list
Alan-rpi wrote:
19 Feb 2020, 12:57
I saw that but couldn't quite figure out how to use it and I was a bit put off using something called Domoticz rather than Relay or Switch. I will look again.
I am a Domoticz user, and this plugin was evolved from the original ESPEasy Domoticz helper. But P029 Output helper can be used for any other system also. Only restirection is, that it will not trigger outgoing mqtt messages, but only waiting incoming commands.

User avatar
enesbcs
Normal user
Posts: 479
Joined: 18 Jun 2017, 11:02
Location: Békéscsaba, Hungary
Contact:

Re: RPIEasy

#208 Post by enesbcs » 22 Feb 2020, 19:55

Alan-rpi wrote:
19 Feb 2020, 12:57
enesbcs wrote:
18 Feb 2020, 23:10
for lazy coders who struggle with numbers.
Quite the opposite, I struggle with words! It's about writing code that is descriptive. With numbers one has to either keep commenting what the GPIO x represents or keep looking up what x represents or trying to remember what x represents.

Once my code is written and working it may not be looked at for months, so when I do come back to it then words will get me up to speed quicker.
All right "taskvalueset" command is enhanced in RPIEasy v2.0.053.
The old form still working:

Code: Select all

taskvalueset,tasknumber,valuenumber,new_value
But also can be used with names:

Code: Select all

taskvalueset,taskname,valuename,new_value

angelo67
Normal user
Posts: 7
Joined: 08 May 2018, 21:32

Re: RPIEasy

#209 Post by angelo67 » 13 Mar 2020, 14:33

Hi,
I would like to implement the text of the notices in the "rules"
I would like to make carriage returns as used in espeasy (this is the% CR% command) as written:
https://www.letscontrolit.com/wiki/inde ... ifications
At the bottom of the page.
For example:
notify 1, The% sysday%.% sysmonth%.% sysyear% alle% systime% % CR% The IP Sensor 192.168.1.223 is broken

laurentm
Normal user
Posts: 4
Joined: 29 Mar 2020, 15:29

Re: RPIEasy

#210 Post by laurentm » 29 Mar 2020, 15:36

Hi,

I try to use Generic - Run OS Command device, to launch a python script. I also tried through the submit command of the tool menu, but the only answer I get is Unknown command.

in the ssh terminal, when using the exact complete path to the script that I use in the "Command" box and it works... (rights are OK, had a +x). I must be doing something wrong, but can't get what. Have you got any idea?

Thanks! Laurent

RobertBurton45
Normal user
Posts: 6
Joined: 28 Feb 2020, 02:46

Re: RPIEasy

#211 Post by RobertBurton45 » 30 Mar 2020, 12:39

enesbcs wrote:
09 Jan 2019, 16:39
asuz wrote:
09 Jan 2019, 15:20
Hello again, I wonder how many 18b20 can be work without problem with pi zero that runs esp firmware without issue?
As i see it is maximized in 10-64 pieces in w1-gpio kernel driver. It is a software limit. (Just checked mine, it writes 64)
You can check it by issuing the following command to the linux console:

Code: Select all

cat /sys/bus/w1/devices/w1_bus_master1/w1_master_max_slave_count 
There are also some hardware limits, such as cable impedance, voltage drop, power supply...
I have got two DS18b20 sensors so i am unable to test it for you. :)
On the hardware side, there are some very insane test results:
https://eduzaurus.com/free-essay-samples/family/
Thank you !
Last edited by RobertBurton45 on 02 Apr 2020, 12:06, edited 1 time in total.

User avatar
enesbcs
Normal user
Posts: 479
Joined: 18 Jun 2017, 11:02
Location: Békéscsaba, Hungary
Contact:

Re: RPIEasy

#212 Post by enesbcs » 30 Mar 2020, 17:16

laurentm wrote:
29 Mar 2020, 15:36
in the ssh terminal, when using the exact complete path to the script that I use in the "Command" box and it works... (rights are OK, had a +x). I must be doing something wrong, but can't get what. Have you got any idea?
You mean you've tried "/usr/bin/python3 complete/path/of/pythonscript.py" ?
This is the complete path with the executable.

laurentm
Normal user
Posts: 4
Joined: 29 Mar 2020, 15:29

Re: RPIEasy

#213 Post by laurentm » 01 Apr 2020, 18:01

enesbcs wrote:
30 Mar 2020, 17:16
laurentm wrote:
29 Mar 2020, 15:36
in the ssh terminal, when using the exact complete path to the script that I use in the "Command" box and it works... (rights are OK, had a +x). I must be doing something wrong, but can't get what. Have you got any idea?
You mean you've tried "/usr/bin/python3 complete/path/of/pythonscript.py" ?
This is the complete path with the executable.
Yes... And to be sure, I typed it exactly that way in a terminal window, it worked.

Here is the result of the command output in the tool menu of rpieasy :

False
16:54:00 : Event: Clock#Time=Wed,16:54
16:55:00 : Event: Clock#Time=Wed,16:55
16:56:00 : Event: Clock#Time=Wed,16:56
16:56:29 : CMD: /usr/bin/python3 /home/pi/nukiPyBridge/open.py
16:56:29 : Unknown command: /usr/bin/python3 /home/pi/nukiPyBridge/open.py

Thanks in advance of your help... Laurent

User avatar
enesbcs
Normal user
Posts: 479
Joined: 18 Jun 2017, 11:02
Location: Békéscsaba, Hungary
Contact:

Re: RPIEasy

#214 Post by enesbcs » 01 Apr 2020, 19:03

laurentm wrote:
01 Apr 2020, 18:01
in the ssh terminal, when using the exact complete path to the script that I use in the "Command" box and it works... (rights are OK, had a +x). I
...
16:56:29 : CMD: /usr/bin/python3 /home/pi/nukiPyBridge/open.py
16:56:29 : Unknown command: /usr/bin/python3 /home/pi/nukiPyBridge/open.py
There has to be some misunderstanding. Command box in RPIEasy is not for Linux commands, it will never work in that way. It is meant for internal ESPEasy/RPIEasy commands.

Currently the only place that an OS command can be added in RPIEasy is the "Generic - Run OS Command" plugin settings page... and it can be triggered by a virtual switch from Domoticz with this IDX or with taskvalueset command...
rpieasycom.jpg
rpieasycom.jpg (106.29 KiB) Viewed 234 times
Otherwise i can add a new command like "eval" to open external python files for internal execution if needed.

laurentm
Normal user
Posts: 4
Joined: 29 Mar 2020, 15:29

Re: RPIEasy

#215 Post by laurentm » 01 Apr 2020, 21:34

enesbcs wrote:
01 Apr 2020, 19:03

Otherwise i can add a new command like "eval" to open external python files for internal execution if needed.
Thanks for the explanation. No need for that. But if I tried it that way, it's because the Run OS Command doesn't trigger the script either... See my config :
capture.png
capture.png (141.97 KiB) Viewed 223 times
When typing TaskValueSet 2,1,1, it triggers the right task (it's task 2):

20:24:00 : Event: Clock#Time=Wed,20:24
20:25:00 : Event: Clock#Time=Wed,20:25
20:26:00 : Event: Clock#Time=Wed,20:26
20:26:49 : CMD: TaskValueSet 2,1,1
20:26:49 : Event: ouvrirPorte#State=1

But the python script isn't launched... I also tried with sudo, but without success. Is there another log I could check to understand what happen "under the hood"?
Thanks! Laurent

User avatar
enesbcs
Normal user
Posts: 479
Joined: 18 Jun 2017, 11:02
Location: Békéscsaba, Hungary
Contact:

Re: RPIEasy

#216 Post by enesbcs » 01 Apr 2020, 22:09

laurentm wrote:
01 Apr 2020, 21:34
But the python script isn't launched... I also tried with sudo, but without success. Is there another log I could check to understand what happen "under the hood"?
I've tested it now. When i am trying to execute an invalid command i am seeing this error message on the Linux Console:

Code: Select all

22:03:06: CMD: taskvalueset,rcmd,State,0                                                                                          
/bin/sh: 1: dfsf: not found                                                                                                       
22:03:06: Event: rcmd#State=0   
Beside of that if you change log level (tools->advanced) to "Debug More" than if there are any output from the command execution and there were no error occured, than it will be printed. Try it with simple commands first, such as "ls".

laurentm
Normal user
Posts: 4
Joined: 29 Mar 2020, 15:29

Re: RPIEasy

#217 Post by laurentm » 01 Apr 2020, 23:03

enesbcs wrote:
01 Apr 2020, 22:09
Try it with simple commands first, such as "ls".
OK, so I changed log level, and then set Command 0 to ls. It works (I don't paste everything, but it's obviously listing the ripeasy directory). I then tried to put a wrong command, as you did, for Command 0, but the output is empty, unlike you... weird. The python script command still doesn't return anything (as if it was wrong, although it works in a Terminal window).

With Command 0 as ls
True
21:31:26 : _C001_DomoHTTP.py
_C002_DomoMQTT.py
_C004_ThingSpeak.py
_C008_GenHTTP.py
_C009_FHEM.py
_C010_GenUDP.py
_C013_ESPEasyP2P.py
_C014_GenMQTT.py
_C015_Blynk.py
_C016_DBStore.py
_C020_LoraDirect.py
_C021_BLEDirect.py
_C022_ESPNow.py
_C023_IFTTT.py
commands.py
...

Here with a wrong command in Command 0 :
True
21:43:00 : Event: Clock#Time=Wed,21:43
21:44:00 : Event: Clock#Time=Wed,21:44
21:44:15 : CMD: TaskValueSet 2,1,0
21:44:15 :
21:44:15 : Event: ouvrirPorte#State=0


The same "nothing" output with the python script :

21:31:26 : Event: ouvrirPorte#State=0
21:31:54 : CMD: TaskValueSet 2,1,1
21:31:54 :
21:31:54 : Event: ouvrirPorte#State=1

Well, I'm stuck... I think I'm gonna reinstall everything to be sure that I didn't make a mistake somewhere. Thanks for your help and above all, thanks for all the work you did to develop rpieasy!
Laurent

User avatar
enesbcs
Normal user
Posts: 479
Joined: 18 Jun 2017, 11:02
Location: Békéscsaba, Hungary
Contact:

Re: RPIEasy

#218 Post by enesbcs » 02 Apr 2020, 19:14

laurentm wrote:
01 Apr 2020, 23:03
The same "nothing" output with the python script :

21:31:26 : Event: ouvrirPorte#State=0
21:31:54 : CMD: TaskValueSet 2,1,1
21:31:54 :
21:31:54 : Event: ouvrirPorte#State=1

Well, I'm stuck... I think I'm gonna reinstall everything to be sure that I didn't make a mistake somewhere. Thanks for your help and above all, thanks for all the work you did to develop rpieasy!
Thanks! I will look after deeper at the weekend.
In the meantime perhaps you could try to save command to an .sh script file and add some debug lines, such as create file, write log on startup in the linux script for more testing.

hvdwolf
Normal user
Posts: 50
Joined: 09 Jun 2016, 12:37

Re: RPIEasy

#219 Post by hvdwolf » 03 Apr 2020, 20:15

Assuming that your python script has the execute bit set like

Code: Select all

chmod +x /home/pi/nukiPyBridgeOpen.py
.
Please add as first line in your python script

Code: Select all

#!/usr/bin/env python3
and then try with

Code: Select all

/home/pi/nukiPyBridgeOpen.py
, so without the /usr/bin/python3
Or
make the first line in your script

Code: Select all

#!/usr/bin/python3
and then try with

Code: Select all

/home/pi/nukiPyBridgeOpen.py
, so again without the /usr/bin/python3

hvdwolf
Normal user
Posts: 50
Joined: 09 Jun 2016, 12:37

Re: RPIEasy

#220 Post by hvdwolf » 04 Apr 2020, 08:46

@enesbcs:
(If you already used/tried this, then sorry for nagging)

You currently use output = os.popen(self.taskdevicepluginconfig[val2])

Isn't it better to use something like:

Code: Select all

output = = subprocess.call(self.taskdevicepluginconfig[val2]))
or if you want to check on the output (returned as a byte string)

Code: Select all

output = subprocess.check_output(self.taskdevicepluginconfig[val2]))
Note also that in case of multiple parameters you need to use someting like a str.split to parse the command, like
subprocess.call(["ls", "-l"])
or
subprocess.call(["/usr/bin/python3", "/home/pi/nukiPyBridgeOpen.py"])

So like

Code: Select all

splitted_val2 = self.taskdevicepluginconfig[val2]).split()
to split on whitespace.
followed by:

Code: Select all

output = = subprocess.call(self.taskdevicepluginconfig[splitted_val2]))
(or combined in one command)

User avatar
enesbcs
Normal user
Posts: 479
Joined: 18 Jun 2017, 11:02
Location: Békéscsaba, Hungary
Contact:

Re: RPIEasy

#221 Post by enesbcs » 05 Apr 2020, 19:47

hvdwolf wrote:
04 Apr 2020, 08:46
You currently use output = os.popen(self.taskdevicepluginconfig[val2])

Isn't it better to use something like:

Code: Select all

output = = subprocess.call(self.taskdevicepluginconfig[val2]))
or if you want to check on the output (returned as a byte string)
Better? I do not think so.
Different? Absolutely.

popen works just fine, and accepting full command line in one string.
In other scripts, where i needs output, i am using other ways, but in this plugin the output is just for Debugging, no use of it.

Post Reply

Who is online

Users browsing this forum: No registered users and 6 guests