GPIO-Binding with 2nd raspberry

Hi,
I startet to build my own smart home with openhab. Up to now i could successfully build in a reed contact in a second pi zero. From the openhab server, it is possible to see if it is open or closed in the garage.

The next step would be switching the lights outside the House. In openhab, i can switch a relay Panel connected to the Server-gpio-Ports. That works fine. But i need to have the relaypanel connected to the pi zero in my Garage. Is it possible to use the gpio binding to swirch gpio ports on a second raspberry?

Thanks in advance for your help.
Schrigga

2 Likes

I don’t know about your question, but isn’t it overkill to use a second raspi for that? A smal Arduino controlled by MQTT (Mosquitto) would be enough for that. cheaper, smaler, less power consumption.
just my thoughts…

For sure! Or even an ESP8266 dev board?

Thanks for your answers. The Price for the second pi was ~ 3£. (A pi zero)

The Plan was to keep the openHAB-Server inside the house. and for the first try I would like to install the zero in the garage.

Is it possible to control the relayboard at the zero via the items file or will I have to work with scriptfiles?

Regards
Schrigga

First of all, you cannot use the GPIO binding to control or read the GPIO pins on another machine. You need OH running on that second machine, which I wouldn’t recommend.

I have a setup almost exactly like you describe. I have an original generation Pi in the garage and I have the GPIOs of that Pi wired up to a dual relay (two garage door openers) and to reed switches (it is also driving an IP camera and doing some other things). I run a Python script on the Pi which can send and receive message with OH using MQTT.

Alternatively, I believe it is possible to configure a REST interface to the GPIO pins in raspi-config in which case you can use the HTTP binding to send/receive state on the remote GPIO pins.

Sometimes “it’s what I have on hand” trumps “its overkill”. :slight_smile:

1 Like

Hi,
thanks for the answers. In the next step i will try to use the Python-script via MQTT. For the first try, I found a solution with a general script. In the *.items file, I define the IP-adress and the port. I found the description in the following link: https://klenzel.de/5190

I takes half a second longer to switch the relais, but i works well.

Are there any reason why i should use the Python-Script instead?

Schrigga

If what you are using works I’d stick to that. Using Python and MQTT you can get some features like discovering when the pi goes off line (last will and testament) and easily set it up so the pi can report states of GPIO pins as well. You can also expand to other sensors like detecting nearby Bluetooth.

hi there,
I think you are right, to use the combination for 2 raspberries via another protocol then the exec-binding.

The reason for that is, that I have another problem and I don’t understand what is the problem. I added another item with the exec binding. I wrote another script, that works well out of the console. But via the exec-binding, Openhab doesn’t switch it.

Switch sw_funk "zero-ssh"  { exec=">[OFF:/scripts/funkmodul.sh 112 2 3 0] >[ON:/scripts/funkmodul.sh 112 2 3 1]" } 

The file funkmodul.sh:

#!/bin/bash
if [ -z “$1” -o -z “$2” -o -z “$3” -o -z “$4” ] ;then
echo "Fehler"
exit 1;
fi
/usr/bin/ssh -i /scripts/.ssh/id_rsa root@192.168.21.$1 “/opt/rc-switch/rcswitch-pi/send c $2 $3 $4”;

I don’t know, where the problem is and how to solve it. I hope anyone of you knows?

Thanks in advance
schrigga

There are the usual things to try:

  • replace spaces with @@
  • make sure to use the full path for everything, including inside your script
  • make sure the openhab user has full permission on everything inside the script
  • use a Rule with val results = executeCommandLine(“cmd”, 5000) and log results to see any errors the command may be generating.

another issue why it is not working could be a simple logon problem.
normally SSH expects a password which you cannot include in the script. So you will need to set up SSH to use an RSA key to log on instead of a password. the “scripts/.ssh/id_rsa” points to that.

having said that, I would think that if the example you first mentioned did work, the ssh issue was solved, but maybe you only tried that first working one from the console

Hi @rlkoshak,

I am moving away from Smartthings and just starting with OpenHAB.
I installed your sensor reporter on remote raspberry Pi zero with (IP address x.x.x.226) that is planned to be used as a sprinkler controller that would receive commands from the Openhabian running on rPi with IP address x.x.x.227 So now the service is running on rPi , but I have some errors (see below):
Would you be so kind to help me with your code?

sensorReporter@raspberrypizero:~ $ systemctl status sensor_reporter.service
    ● sensor_reporter.service - Reports status and sensor readings over MQTT and openHAB REST
       Loaded: loaded (/etc/systemd/system/sensor_reporter.service; enabled; vendor preset: enabled)
       Active: active (running) since Sat 2020-12-19 01:22:28 CET; 24min ago
     Main PID: 358 (python3)
        Tasks: 1 (limit: 881)
       CGroup: /system.slice/sensor_reporter.service
               └─358 /usr/bin/python3 sensor_reporter.py sensor_reporter.ini

Dec 19 01:22:49 raspberrypizero python3[358]: ERROR - [sensor_reporter] Error creating device Actuator3: Traceback (most recent call last):
                                                File "sensor_reporter.py", line 165, in create_device
                                                  dev_conns = [connections[c] for c in params("Connection").split(",")]
                                                File "sensor_reporter.py", line 165, in <listcomp>
                                                  dev_conns = [connections[c] for c in params("Connection").split(",")]
                                              KeyError: 'openHAB'
Dec 19 01:22:49 raspberrypizero python3[358]: INFO - [sensor_reporter] Creating device for Actuator4
Dec 19 01:22:49 raspberrypizero python3[358]: ERROR - [sensor_reporter] Error creating device Actuator4: Traceback (most recent call last):
                                                File "sensor_reporter.py", line 165, in create_device
                                                  dev_conns = [connections[c] for c in params("Connection").split(",")]
                                                File "sensor_reporter.py", line 165, in <listcomp>
                                                  dev_conns = [connections[c] for c in params("Connection").split(",")]
                                              KeyError: 'openHAB'
Dec 19 01:22:49 raspberrypizero python3[358]: INFO - [sensor_reporter] Creating device for Actuator5
Dec 19 01:22:49 raspberrypizero python3[358]: ERROR - [sensor_reporter] Error creating device Actuator5: Traceback (most recent call last):
                                                File "sensor_reporter.py", line 165, in create_device
                                                  dev_conns = [connections[c] for c in params("Connection").split(",")]
                                                File "sensor_reporter.py", line 165, in <listcomp>
                                                  dev_conns = [connections[c] for c in params("Connection").split(",")]
                                              KeyError: 'openHAB'
Dec 19 01:22:49 raspberrypizero python3[358]: INFO - [sensor_reporter] Creating device for Actuator6
Dec 19 01:22:49 raspberrypizero python3[358]: ERROR - [sensor_reporter] Error creating device Actuator6: Traceback (most recent call last):
                                                File "sensor_reporter.py", line 165, in create_device
                                                  dev_conns = [connections[c] for c in params("Connection").split(",")]
                                                File "sensor_reporter.py", line 165, in <listcomp>
                                                  dev_conns = [connections[c] for c in params("Connection").split(",")]
                                              KeyError: 'openHAB'
Dec 19 01:22:49 raspberrypizero python3[358]: INFO - [sensor_reporter] Creating device for Sensor1
Dec 19 01:22:49 raspberrypizero python3[358]: ERROR - [sensor_reporter] Error creating device Sensor1: Traceback (most recent call last):
                                                File "sensor_reporter.py", line 165, in create_device
                                                  dev_conns = [connections[c] for c in params("Connection").split(",")]
                                                File "sensor_reporter.py", line 165, in <listcomp>
                                                  dev_conns = [connections[c] for c in params("Connection").split(",")]
                                              KeyError: 'openHAB'
Dec 19 01:22:49 raspberrypizero python3[358]: INFO - [PollManager] Starting polling loop
lines 2-43/43 (END)
sensorReporter@raspberrypizero:~ $

My config.ini is as follows:

[Logging]
Syslog = YES
Level = INFO

[Connection1]
Class = openhab_rest.rest_conn.OpenhabREST
Name = openHAB
URL = http://localhost:8080
RefreshItem = Test_Refresh
Level = INFO

[Sensor1]
Class = heartbeat.heartbeat.Heartbeat
Connection = openHAB
Poll = 60
Num-Dest = heartbeat/num
Str-Dest = heartbeat/str
Level = INFO

[Actuator0]
Class = gpio.rpi_gpio.RpiGpioActuator
Connection = openHAB
CommandSrc = SprinklerTerrasCmd
Pin = 5

[Actuator1]
Class = gpio.rpi_gpio.RpiGpioActuator
Connection = openHAB
CommandSrc = SprinklersGardenHouseCmd
Pin = 6

[Actuator2]
Class = gpio.rpi_gpio.RpiGpioActuator
Connection = openHAB
CommandSrc = SprinklersEntranceCmd
Pin = 13

[Actuator3]
Class = gpio.rpi_gpio.RpiGpioActuator
Connection = openHAB
CommandSrc = SprinklersFrontCmd
Pin = 19

[Actuator4]
Class = gpio.rpi_gpio.RpiGpioActuator
Connection = openHAB
CommandSrc = DripHoseCmd
Pin = 26

[Actuator5]
Class = gpio.rpi_gpio.RpiGpioActuator
Connection = openHAB
CommandSrc = PumpCmd
Pin = 28

[Actuator6]
Class = gpio.rpi_gpio.RpiGpioActuator
Connection = openHAB
CommandSrc = FilterWashCmd
Pin = 29

Also when I try to test the REST API, I can’t connect. I have only basic experience with rest and below is how I test it. Am I sending the right command here?

P.S I did face some problems when following your instructions for installing the service:

sudo -u sensorReporter ln -s <path to config.ini> /opt/sensor_reporter/sensor_reporter.ini

didn’t work so I had to use:

sudo ln -s <path to config.ini> /opt/sensor_reporter/sensor_reporter.ini

and also there is a typo in:

sudo sytemctl start sensor_reporter

(I think it should be systemctl start sensor_reporter.service).

Thanks

OK, I got the service working. I modified the GPIO pins in the config.ini and it seems all working now.

However I still can’t access the REST API.

If sensor_reporter isn’t running on the same machine as openHAB, you have to configure the URlL to use the up address or hostname for where openHAB is running. localhost means “on this machine”.

I can’t tell. Screenshots are basically unreadable on my phone. But openHAB has REST API docs you can install which are interactive and will show you the curl command that goes with each.

Thanks, when I changed the localhost to the IP address of the OpenHab, I noted that the relays connected to the GPIO changed state (they have become outputs, and I had to invert them).

I don’t get this one, if I execute commands on the openhab REST API tool, I can only see the local devices (which I assume is logical since I do not have the remote items defined yet in the openhab). As mentioned in my previous post, the Openhab runs on IP address ending on 227, however the remote Pi is on address 226. If I use exactly same command on 226 the connection fails.
Is your application somehow registering the remote devices into the REST API on the Pi where the openhabian is running? If yes I can’t see them

you said you were trying to rest the rest api on openHAB… The rest api docs does you how to treat the openHAB rest api.

I am looking at the REST API documentation, but I can only see the local items, not the items from the remote Pi.

Also if I try MQTT, I only see the heartbeat with MQTT explorer. Could it be that there is something wrong with the configuration of the actuators? They are configured as follows:

[Sensor1]
Class = heartbeat.heartbeat.Heartbeat
Connection = MQTTSprinklers, openHAB
Poll = 60
Num-Dest = heartbeat/num
Str-Dest = heartbeat/str

[Actuator0]
Class = gpio.rpi_gpio.RpiGpioActuator
Connection = MQTTSprinklers, openHAB
CommandSrc  = SprinklerTerrasCmd
InitialState = ON
Pin = 26
Level = DEBUG

[Actuator1]
Class = gpio.rpi_gpio.RpiGpioActuator
Connection = MQTTSprinklers, openHAB
CommandSrc = SprinklersGardenHouseCmd
InitialState = ON
Pin = 19
Level = DEBUG

[Actuator2]
Class = gpio.rpi_gpio.RpiGpioActuator
Connection = MQTTSprinklers, openHAB
CommandSrc = SprinklersEntranceCmd
InitialState = ON
Pin = 13
Level = DEBUG

[Actuator3]
Class = gpio.rpi_gpio.RpiGpioActuator
Connection = MQTTSprinklers, openHAB
CommandSrc = SprinklersFrontCmd
InitialState = ON
Pin = 6
Level = DEBUG

[Actuator4]
Class = gpio.rpi_gpio.RpiGpioActuator
Connection = MQTTSprinklers, openHAB
CommandSrc = DripHoseCmd
InitialState = ON
Pin = 5
Level = DEBUG

[Actuator5]
Class = gpio.rpi_gpio.RpiGpioActuator
Connection = MQTTSprinklers, openHAB
CommandSrc = PumpCmd
InitialState = ON
Pin = 0
Level = DEBUG

[Actuator6]
Class = gpio.rpi_gpio.RpiGpioActuator
Connection = MQTTSprinklers, openHAB
CommandSrc = Spare1Cmd
InitialState = ON
Pin = 11
Level = DEBUG

[Actuator7]
Class = gpio.rpi_gpio.RpiGpioActuator
Connection = MQTTSprinklers, openHAB
CommandSrc = Spare2Cmd
InitialState = ON
Pin = 9
Level = DEBUG

I also noted another issue on the remote Pi. After reboot, the service failed to start correctly again and gave error message. After restarting of the service the message disappeared. The remote is Pi Zero, so maybe the issues are because of the slow start?

There are no Items on the remote pi.

For Actuator 0 you need to create an Item named SprinklerTerrasCmd or publish to an MQTT topic that ends with SprinklerTerrasCmd. You don’t show the configuration for the MQTTSprinklers Communicator so I can’t say what the start of the topic will be.

Actuators subscribe for messages on the Command sec. You need to configure openHAB to do this publish to what is begging being subscribed to.

Hi @rlkoshak,

Still no success.

I found one topic where you nicely described what needs to be done and I followed it, but no luck, I only receive the heartbeat, however I cant send commands.
Here is my complete configuration:

  1. The conf.ini file on the remote Pi

     [Logging]
     Syslog = YES
     Level = DEBUG
    
     [Connection1]
     Class = openhab_rest.rest_conn.OpenhabREST
     Name = openHAB
     URL = http://192.168.4.227:8080
     RefreshItem = RefreshSprinklers
     Level = DEBUG
    
     [Connection2]
     Class = mqtt.mqtt_conn.MqttConnection
     Name = MQTTSprinklers
     Client = rPiZero
     User = ****
     Password = ****
     Host = 192.168.4.227
     Port = 1883
     Keepalive = 10
     RootTopic = sensor_reporter
     TLS = NO
     Level = DEBUG
    
     [Sensor1]
     Class = heartbeat.heartbeat.Heartbeat
     Connection = MQTTSprinklers
     Poll = 60
     Num-Dest = heartbeat/num
     Str-Dest = heartbeat/str
    
     [Actuator0]
     Class = gpio.rpi_gpio.RpiGpioActuator
     Connection = MQTTSprinklers, openHAB
     CommandSrc  = SprinklersTerraceCmd
     InitialState = ON
     Pin = 26
     Level = DEBUG
    
     [Actuator1]
     Class = gpio.rpi_gpio.RpiGpioActuator
     Connection = MQTTSprinklers, openHAB
     CommandSrc = SprinklersGardenHouseCmd
     InitialState = ON
     Pin = 19
     Level = DEBUG
    
     [Actuator2]
     Class = gpio.rpi_gpio.RpiGpioActuator
     Connection = MQTTSprinklers, openHAB
     CommandSrc = SprinklersEntranceCmd
     InitialState = ON
     Pin = 13
     Level = DEBUG
    
     [Actuator3]
     Class = gpio.rpi_gpio.RpiGpioActuator
     Connection = MQTTSprinklers, openHAB
     CommandSrc = SprinklersFrontCmd
     InitialState = ON
     Pin = 6
     Level = DEBUG
    
     [Actuator4]
     Class = gpio.rpi_gpio.RpiGpioActuator
     Connection = MQTTSprinklers, openHAB
     CommandSrc = DripHoseCmd
     InitialState = ON
     Pin = 5
     Level = DEBUG
    
     [Actuator5]
     Class = gpio.rpi_gpio.RpiGpioActuator
     Connection = MQTTSprinklers, openHAB
     CommandSrc = SprinkerPumpCmd
     InitialState = ON
     Pin = 0
     Level = DEBUG
    
     [Actuator6]
     Class = gpio.rpi_gpio.RpiGpioActuator
     Connection = MQTTSprinklers, openHAB
     CommandSrc = SprinklerPiRelay7Cmd
     InitialState = ON
     Pin = 11
     Level = DEBUG
    
     [Actuator7]
     Class = gpio.rpi_gpio.RpiGpioActuator
     Connection = MQTTSprinklers, openHAB
     CommandSrc = SprinklerPiRelay8Cmd
     InitialState = ON
     Pin = 9
     Level = DEBUG
    
  2. My MQTT broker config (running on the openhabian Pi4):

  1. Generic MQTT thing:

  1. Items in PAPER UI:

  1. Item configuration file:

     //Sprinkler system
     Group               groupSprinklers             "Sprinklers"                <faucet>        (groupOutside)                                                   
     Switch              SprinklerTerraceCmd          "Sprinklers Terrace"        <rain>          (groupSprinklers)      {channel="mqtt:topic:sensor_reporter:SprinklersTerraceCmd"}
     Switch              SprinklersGardenHouseCmd    "Sprinklers Garden House"   <rain>          (groupSprinklers)      {channel="mqtt:topic:sensor_reporter:SprinklersGardenHouseCmd"}
     Switch              SprinklersEntranceCmd       "Sprinklers Entrance"       <rain>          (groupSprinklers)      {channel="mqtt:topic:sensor_reporter:SprinklersEntranceCmd"}
     Switch              SprinklersFrontCmd          "Sprinklers  Front"         <rain>          (groupSprinklers)      {channel="mqtt:topic:sensor_reporter:SprinklersFrontCmd"}
     Switch              DripHoseCmd                 "Drip Hose"                 <rain>          (groupSprinklers)      {channel="mqtt:topic:sensor_reporter:DripHoseCmd"}
     Switch              SprinkerPumpCmd             "Sprinkler Pump"            <rain>          (groupSprinklers)      {channel="mqtt:topic:sensor_reporter:SprinklerPiPumpCmd"}
     Switch              SprinklerPiRelay7Cmd        "Relay 7"                                   (groupSprinklers)      {channel="mqtt:topic:sensor_reporter:SprinklerPiRelay7Cmd"}
     Switch              SprinklerPiRelay8Cmd        "Relay 8"                                   (groupSprinklers)      {channel="mqtt:topic:sensor_reporter:SprinklerPiRelay8Cmd"}
     Number              SprinklerPiStaus            "Sprinkler MQTT Status"       <status>        (groupSprinklers)      {channel="mqtt:topic:sensor_reporter:num"}
    
  2. MQTT Explorer

  1. Open HAB Log

     2020-12-21 00:27:08.655 [ome.event.ItemCommandEvent] - Item 'SprinklerTerraceCmd' received command ON
    
     2020-12-21 00:27:08.691 [nt.ItemStatePredictedEvent] - SprinklerTerraceCmd predicted to become ON
    
     2020-12-21 00:27:08.728 [vent.ItemStateChangedEvent] - SprinklerTerraceCmd changed from OFF to ON
    
     2020-12-21 00:27:39.441 [vent.ItemStateChangedEvent] - SprinklerPiStatus changed from 2465095 to 2525230
    
  2. remote PI GPIO status

As I said before, I can’t do anything with screen shots.

Why are you using openHAB and MQTT? Pick one and just use that. There is no need to ever use more than one communicators on a given sensor or Actuator to connect to openHAB. I’ve never tested that and I’ve no idea if it will work.

You’ve confirmed that the MQTT is working because that is what you have the heartbeat using so just use that.

The root topic is oing to be sensor_reporter as configured so, the hearbeat stuff gets published to sensor_reporter/heartbeat/num.

So assuming MQTT, to command Actuator1 you need to configure openHAB to publish “ON” or “OFF” or “TOGGLE” as the message to the topic sensor_reporter/SprinklersGardenHouseCmd.

Right now about the best I can suggest is that it doesn’t work with two communicators defined on the same Actuator. Without logs that I can read from sensor_reporter I can’t guess any anything more specific or even guess why it doesn’t work that way.

Hi @rlkoshak

I am trying to figure out which link I can get working, so this is still in test phase and that is why 2 protocols are still in the file.

I looked in the log and apparently there is error in creating all actuators. That is why is not working:

    Dec 21 18:59:15 raspberrypizero INFO - [MqttConnection] Disconnected from MQTT broker with client <paho.mqtt.client.Client object at 0xb653d330>, userdata None, and code 0
Dec 21 18:59:15 raspberrypizero python3[5954]: /opt/sensor_reporter/gpio/rpi_gpio.py:140: RuntimeWarning: This channel is already in use, continuing anyway.  Use GPIO.setwarnings(False) to disable warnings.
Dec 21 18:59:15 raspberrypizero python3[5954]:   GPIO.setup(self.pin, GPIO.OUT)
Dec 21 18:59:15 raspberrypizero python3[5954]: Exception in thread Thread-1:
Dec 21 18:59:15 raspberrypizero python3[5954]: Traceback (most recent call last):
Dec 21 18:59:15 raspberrypizero python3[5954]:   File "/usr/lib/python3.7/threading.py", line 917, in _bootstrap_inner
Dec 21 18:59:15 raspberrypizero python3[5954]:     self.run()
Dec 21 18:59:15 raspberrypizero python3[5954]:   File "/usr/lib/python3.7/threading.py", line 865, in run
Dec 21 18:59:15 raspberrypizero python3[5954]:     self._target(*self._args, **self._kwargs)
Dec 21 18:59:15 raspberrypizero python3[5954]:   File "/usr/local/lib/python3.7/dist-packages/paho/mqtt/client.py", line 3452, in _thread_main
Dec 21 18:59:15 raspberrypizero python3[5954]:     self.loop_forever(retry_first_connection=True)
Dec 21 18:59:15 raspberrypizero python3[5954]:   File "/usr/local/lib/python3.7/dist-packages/paho/mqtt/client.py", line 1779, in loop_forever
Dec 21 18:59:15 raspberrypizero python3[5954]:     rc = self.loop(timeout, max_packets)
Dec 21 18:59:15 raspberrypizero python3[5954]:   File "/usr/local/lib/python3.7/dist-packages/paho/mqtt/client.py", line 1181, in loop
Dec 21 18:59:15 raspberrypizero python3[5954]:     rc = self.loop_read(max_packets)
Dec 21 18:59:15 raspberrypizero python3[5954]:   File "/usr/local/lib/python3.7/dist-packages/paho/mqtt/client.py", line 1572, in loop_read
Dec 21 18:59:15 raspberrypizero python3[5954]:     rc = self._packet_read()
Dec 21 18:59:15 raspberrypizero python3[5954]:   File "/usr/local/lib/python3.7/dist-packages/paho/mqtt/client.py", line 2310, in _packet_read
Dec 21 18:59:15 raspberrypizero python3[5954]:     rc = self._packet_handle()
Dec 21 18:59:15 raspberrypizero python3[5954]:   File "/usr/local/lib/python3.7/dist-packages/paho/mqtt/client.py", line 2936, in _packet_handle
Dec 21 18:59:15 raspberrypizero python3[5954]:     return self._handle_publish()
Dec 21 18:59:15 raspberrypizero python3[5954]:   File "/usr/local/lib/python3.7/dist-packages/paho/mqtt/client.py", line 3216, in _handle_publish
Dec 21 18:59:15 raspberrypizero python3[5954]:     self._handle_on_message(message)
Dec 21 18:59:15 raspberrypizero python3[5954]:   File "/usr/local/lib/python3.7/dist-packages/paho/mqtt/client.py", line 3429, in _handle_on_message
Dec 21 18:59:15 raspberrypizero python3[5954]:     callback(self, self._userdata, message)
Dec 21 18:59:15 raspberrypizero python3[5954]:   File "/opt/sensor_reporter/mqtt/mqtt_conn.py", line 147, in on_message
Dec 21 18:59:15 raspberrypizero python3[5954]:     handler(msg.payload.decode("utf-8"))
Dec 21 18:59:15 raspberrypizero python3[5954]:   File "/opt/sensor_reporter/gpio/rpi_gpio.py", line 159, in on_message
Dec 21 18:59:15 raspberrypizero python3[5954]:     self.cmd_src, msg, self.toggle, self.pin)
Dec 21 18:59:15 raspberrypizero python3[5954]: AttributeError: 'RpiGpioActuator' object has no attribute 'toggle'
Dec 21 18:59:15 raspberrypizero systemd[1]: sensor_reporter.service: Succeeded.
Dec 21 18:59:15 raspberrypizero systemd[1]: Stopped Reports status and sensor readings over MQTT and openHAB REST.
Dec 21 18:59:19 raspberrypizero systemd[1]: Started Reports status and sensor readings over MQTT and openHAB REST.
Dec 21 18:59:20 raspberrypizero INFO - [sensor_reporter] Setting logging level to DEBUG
Dec 21 18:59:20 raspberrypizero INFO - [sensor_reporter] Creating connection MQTTSprinklers
Dec 21 18:59:20 raspberrypizero INFO - [MqttConnection] Initializing MQTT Connection...
Dec 21 18:59:20 raspberrypizero INFO - [MqttConnection] Attempting to connect to MQTT broker at 192.168.4.227:1883
Dec 21 18:59:20 raspberrypizero INFO - [MqttConnection] Connection to MQTT is successful
Dec 21 18:59:20 raspberrypizero INFO - [MqttConnection] LWT topic is sensor_reporter/status, subscribing to refresh topic sensor_reporter/refresh
Dec 21 18:59:20 raspberrypizero INFO - [MqttConnection] Registering for messages on 'sensor_reporter/refresh'
Dec 21 18:59:20 raspberrypizero DEBUG - [MqttConnection] Published message ONLINE to sensor_reporter/status retain=True
Dec 21 18:59:20 raspberrypizero DEBUG - [sensor_reporter] 1 connections created
Dec 21 18:59:20 raspberrypizero INFO - [sensor_reporter] Creating device for Actuator0
Dec 21 18:59:20 raspberrypizero INFO - [MqttConnection] Connected with client <paho.mqtt.client.Client object at 0xb64e6330>, userdata None, flags {'session present': 0}, and result code 0. Subscribing to refresh command topic sensor_reporter/refresh
Dec 21 18:59:20 raspberrypizero DEBUG - [MqttConnection] Published message ONLINE to sensor_reporter/status retain=True
Dec 21 18:59:20 raspberrypizero INFO - [MqttConnection] on_connect: Resubscribing to sensor_reporter/refresh
Dec 21 18:59:21 raspberrypizero INFO - [sensor_reporter] Received a request for current sensor states before poll_mgr has been created, ignoring.
Dec 21 18:59:21 raspberrypizero DEBUG - [MqttConnection] on_publish: Successfully published message <paho.mqtt.client.Client object at 0xb64e6330>, None, 2
Dec 21 18:59:21 raspberrypizero DEBUG - [MqttConnection] on_publish: Successfully published message <paho.mqtt.client.Client object at 0xb64e6330>, None, 3
Dec 21 18:59:21 raspberrypizero DEBUG - [MqttConnection] on_subscribe: Successfully subscribed <paho.mqtt.client.Client object at 0xb64e6330>, None, 1, (0,)
Dec 21 18:59:21 raspberrypizero DEBUG - [MqttConnection] on_subscribe: Successfully subscribed <paho.mqtt.client.Client object at 0xb64e6330>, None, 4, (0,)
Dec 21 18:59:21 raspberrypizero INFO - [MqttConnection] Registering for messages on 'sensor_reporter/SprinklersTerraceCmd'
Dec 21 18:59:21 raspberrypizero DEBUG - [MqttConnection] on_subscribe: Successfully subscribed <paho.mqtt.client.Client object at 0xb64e6330>, None, 5, (0,)
Dec 21 18:59:21 raspberrypizero ERROR - [sensor_reporter] Error creating device Actuator0: Traceback (most recent call last):#012  File "/usr/lib/python3.7/configparser.py", line 788, in get#012    value = d[option]#012  File "/usr/lib/python3.7/collections/__init__.py", line 914, in __getitem__#012    return self.__missing__(key)            # support subclasses that define __missing__#012  File "/usr/lib/python3.7/collections/__init__.py", line 906, in __missing__#012    raise KeyError(key)#012KeyError: 'toggle'#012#012During handling of the above exception, another exception occurred:#012#012Traceback (most recent call last):#012  File "sensor_reporter.py", line 170, in create_device#012    return device(dev_conns, params)#012  File "/opt/sensor_reporter/gpio/rpi_gpio.py", line 149, in __init__#012    self.toggle = bool(params("Toggle"))#012  File "sensor_reporter.py", line 161, in <lambda>#012    params = lambda key: config.get(section, key)#012  File "/usr/lib/python3.7/configparser.py", line 791, in get#012    raise NoOptionError(option, section)#012configparser.NoOptionError: No option 'toggle' in section: 'Actuator0'
Dec 21 18:59:21 raspberrypizero INFO - [sensor_reporter] Creating device for Actuator1
Dec 21 18:59:21 raspberrypizero INFO - [MqttConnection] Registering for messages on 'sensor_reporter/SprinklersGardenHouseCmd'
Dec 21 18:59:21 raspberrypizero DEBUG - [MqttConnection] on_subscribe: Successfully subscribed <paho.mqtt.client.Client object at 0xb64e6330>, None, 6, (0,)
Dec 21 18:59:21 raspberrypizero ERROR - [sensor_reporter] Error creating device Actuator1: Traceback (most recent call last):#012  File "/usr/lib/python3.7/configparser.py", line 788, in get#012    value = d[option]#012  File "/usr/lib/python3.7/collections/__init__.py", line 914, in __getitem__#012    return self.__missing__(key)            # support subclasses that define __missing__#012  File "/usr/lib/python3.7/collections/__init__.py", line 906, in __missing__#012    raise KeyError(key)#012KeyError: 'toggle'#012#012During handling of the above exception, another exception occurred:#012#012Traceback (most recent call last):#012  File "sensor_reporter.py", line 170, in create_device#012    return device(dev_conns, params)#012  File "/opt/sensor_reporter/gpio/rpi_gpio.py", line 149, in __init__#012    self.toggle = bool(params("Toggle"))#012  File "sensor_reporter.py", line 161, in <lambda>#012    params = lambda key: config.get(section, key)#012  File "/usr/lib/python3.7/configparser.py", line 791, in get#012    raise NoOptionError(option, section)#012configparser.NoOptionError: No option 'toggle' in section: 'Actuator1'
Dec 21 18:59:21 raspberrypizero INFO - [sensor_reporter] Creating device for Actuator2
Dec 21 18:59:21 raspberrypizero INFO - [MqttConnection] Registering for messages on 'sensor_reporter/SprinklersEntranceCmd'
Dec 21 18:59:21 raspberrypizero DEBUG - [MqttConnection] on_subscribe: Successfully subscribed <paho.mqtt.client.Client object at 0xb64e6330>, None, 7, (0,)
Dec 21 18:59:21 raspberrypizero ERROR - [sensor_reporter] Error creating device Actuator2: Traceback (most recent call last):#012  File "/usr/lib/python3.7/configparser.py", line 788, in get#012    value = d[option]#012  File "/usr/lib/python3.7/collections/__init__.py", line 914, in __getitem__#012    return self.__missing__(key)            # support subclasses that define __missing__#012  File "/usr/lib/python3.7/collections/__init__.py", line 906, in __missing__#012    raise KeyError(key)#012KeyError: 'toggle'#012#012During handling of the above exception, another exception occurred:#012#012Traceback (most recent call last):#012  File "sensor_reporter.py", line 170, in create_device#012    return device(dev_conns, params)#012  File "/opt/sensor_reporter/gpio/rpi_gpio.py", line 149, in __init__#012    self.toggle = bool(params("Toggle"))#012  File "sensor_reporter.py", line 161, in <lambda>#012    params = lambda key: config.get(section, key)#012  File "/usr/lib/python3.7/configparser.py", line 791, in get#012    raise NoOptionError(option, section)#012configparser.NoOptionError: No option 'toggle' in section: 'Actuator2'
Dec 21 18:59:21 raspberrypizero INFO - [sensor_reporter] Creating device for Actuator3
Dec 21 18:59:21 raspberrypizero INFO - [MqttConnection] Registering for messages on 'sensor_reporter/SprinklersFrontCmd'
Dec 21 18:59:21 raspberrypizero DEBUG - [MqttConnection] on_subscribe: Successfully subscribed <paho.mqtt.client.Client object at 0xb64e6330>, None, 8, (0,)
Dec 21 18:59:21 raspberrypizero ERROR - [sensor_reporter] Error creating device Actuator3: Traceback (most recent call last):#012  File "/usr/lib/python3.7/configparser.py", line 788, in get#012    value = d[option]#012  File "/usr/lib/python3.7/collections/__init__.py", line 914, in __getitem__#012    return self.__missing__(key)            # support subclasses that define __missing__#012  File "/usr/lib/python3.7/collections/__init__.py", line 906, in __missing__#012    raise KeyError(key)#012KeyError: 'toggle'#012#012During handling of the above exception, another exception occurred:#012#012Traceback (most recent call last):#012  File "sensor_reporter.py", line 170, in create_device#012    return device(dev_conns, params)#012  File "/opt/sensor_reporter/gpio/rpi_gpio.py", line 149, in __init__#012    self.toggle = bool(params("Toggle"))#012  File "sensor_reporter.py", line 161, in <lambda>#012    params = lambda key: config.get(section, key)#012  File "/usr/lib/python3.7/configparser.py", line 791, in get#012    raise NoOptionError(option, section)#012configparser.NoOptionError: No option 'toggle' in section: 'Actuator3'
Dec 21 18:59:21 raspberrypizero INFO - [sensor_reporter] Creating device for Actuator4
Dec 21 18:59:21 raspberrypizero INFO - [MqttConnection] Registering for messages on 'sensor_reporter/DripHoseCmd'
Dec 21 18:59:21 raspberrypizero DEBUG - [MqttConnection] on_subscribe: Successfully subscribed <paho.mqtt.client.Client object at 0xb64e6330>, None, 9, (0,)
Dec 21 18:59:21 raspberrypizero ERROR - [sensor_reporter] Error creating device Actuator4: Traceback (most recent call last):#012  File "/usr/lib/python3.7/configparser.py", line 788, in get#012    value = d[option]#012  File "/usr/lib/python3.7/collections/__init__.py", line 914, in __getitem__#012    return self.__missing__(key)            # support subclasses that define __missing__#012  File "/usr/lib/python3.7/collections/__init__.py", line 906, in __missing__#012    raise KeyError(key)#012KeyError: 'toggle'#012#012During handling of the above exception, another exception occurred:#012#012Traceback (most recent call last):#012  File "sensor_reporter.py", line 170, in create_device#012    return device(dev_conns, params)#012  File "/opt/sensor_reporter/gpio/rpi_gpio.py", line 149, in __init__#012    self.toggle = bool(params("Toggle"))#012  File "sensor_reporter.py", line 161, in <lambda>#012    params = lambda key: config.get(section, key)#012  File "/usr/lib/python3.7/configparser.py", line 791, in get#012    raise NoOptionError(option, section)#012configparser.NoOptionError: No option 'toggle' in section: 'Actuator4'
Dec 21 18:59:21 raspberrypizero INFO - [sensor_reporter] Creating device for Actuator5
Dec 21 18:59:21 raspberrypizero INFO - [MqttConnection] Registering for messages on 'sensor_reporter/SprinkerPumpCmd'
Dec 21 18:59:21 raspberrypizero DEBUG - [MqttConnection] on_subscribe: Successfully subscribed <paho.mqtt.client.Client object at 0xb64e6330>, None, 10, (0,)
Dec 21 18:59:21 raspberrypizero ERROR - [sensor_reporter] Error creating device Actuator5: Traceback (most recent call last):#012  File "/usr/lib/python3.7/configparser.py", line 788, in get#012    value = d[option]#012  File "/usr/lib/python3.7/collections/__init__.py", line 914, in __getitem__#012    return self.__missing__(key)            # support subclasses that define __missing__#012  File "/usr/lib/python3.7/collections/__init__.py", line 906, in __missing__#012    raise KeyError(key)#012KeyError: 'toggle'#012#012During handling of the above exception, another exception occurred:#012#012Traceback (most recent call last):#012  File "sensor_reporter.py", line 170, in create_device#012    return device(dev_conns, params)#012  File "/opt/sensor_reporter/gpio/rpi_gpio.py", line 149, in __init__#012    self.toggle = bool(params("Toggle"))#012  File "sensor_reporter.py", line 161, in <lambda>#012    params = lambda key: config.get(section, key)#012  File "/usr/lib/python3.7/configparser.py", line 791, in get#012    raise NoOptionError(option, section)#012configparser.NoOptionError: No option 'toggle' in section: 'Actuator5'
Dec 21 18:59:21 raspberrypizero INFO - [sensor_reporter] Creating device for Actuator6
Dec 21 18:59:21 raspberrypizero INFO - [MqttConnection] Registering for messages on 'sensor_reporter/SprinklerPiRelay7Cmd'
Dec 21 18:59:21 raspberrypizero ERROR - [sensor_reporter] Error creating device Actuator6: Traceback (most recent call last):#012  File "/usr/lib/python3.7/configparser.py", line 788, in get#012    value = d[option]#012  File "/usr/lib/python3.7/collections/__init__.py", line 914, in __getitem__#012    return self.__missing__(key)            # support subclasses that define __missing__#012  File "/usr/lib/python3.7/collections/__init__.py", line 906, in __missing__#012    raise KeyError(key)#012KeyError: 'toggle'#012#012During handling of the above exception, another exception occurred:#012#012Traceback (most recent call last):#012  File "sensor_reporter.py", line 170, in create_device#012    return device(dev_conns, params)#012  File "/opt/sensor_reporter/gpio/rpi_gpio.py", line 149, in __init__#012    self.toggle = bool(params("Toggle"))#012  File "sensor_reporter.py", line 161, in <lambda>#012    params = lambda key: config.get(section, key)#012  File "/usr/lib/python3.7/configparser.py", line 791, in get#012    raise NoOptionError(option, section)#012configparser.NoOptionError: No option 'toggle' in section: 'Actuator6'
Dec 21 18:59:21 raspberrypizero DEBUG - [MqttConnection] on_subscribe: Successfully subscribed <paho.mqtt.client.Client object at 0xb64e6330>, None, 11, (0,)
Dec 21 18:59:21 raspberrypizero INFO - [sensor_reporter] Creating device for Actuator7
Dec 21 18:59:21 raspberrypizero INFO - [MqttConnection] Registering for messages on 'sensor_reporter/SprinklerPiRelay8Cmd'
Dec 21 18:59:21 raspberrypizero DEBUG - [MqttConnection] on_subscribe: Successfully subscribed <paho.mqtt.client.Client object at 0xb64e6330>, None, 12, (0,)
Dec 21 18:59:21 raspberrypizero ERROR - [sensor_reporter] Error creating device Actuator7: Traceback (most recent call last):#012  File "/usr/lib/python3.7/configparser.py", line 788, in get#012    value = d[option]#012  File "/usr/lib/python3.7/collections/__init__.py", line 914, in __getitem__#012    return self.__missing__(key)            # support subclasses that define __missing__#012  File "/usr/lib/python3.7/collections/__init__.py", line 906, in __missing__#012    raise KeyError(key)#012KeyError: 'toggle'#012#012During handling of the above exception, another exception occurred:#012#012Traceback (most recent call last):#012  File "sensor_reporter.py", line 170, in create_device#012    return device(dev_conns, params)#012  File "/opt/sensor_reporter/gpio/rpi_gpio.py", line 149, in __init__#012    self.toggle = bool(params("Toggle"))#012  File "sensor_reporter.py", line 161, in <lambda>#012    params = lambda key: config.get(section, key)#012  File "/usr/lib/python3.7/configparser.py", line 791, in get#012    raise NoOptionError(option, section)#012configparser.NoOptionError: No option 'toggle' in section: 'Actuator7'
Dec 21 18:59:21 raspberrypizero DEBUG - [sensor_reporter] 0 actuators created
Dec 21 18:59:21 raspberrypizero INFO - [sensor_reporter] Creating device for Sensor1
Dec 21 18:59:21 raspberrypizero INFO - [Heartbeat] Configuing Heartbeat: msec to heartbeat/num and str to heartbeat/str with interval 60.0
Dec 21 18:59:21 raspberrypizero DEBUG - [sensor_reporter] 1 sensors created
Dec 21 18:59:21 raspberrypizero DEBUG - [sensor_reporter] Creating polling manager
Dec 21 18:59:21 raspberrypizero DEBUG - [sensor_reporter] Created, returning polling manager
Dec 21 18:59:21 raspberrypizero INFO - [PollManager] Starting polling loop
Dec 21 18:59:21 raspberrypizero DEBUG - [MqttConnection] on_publish: Successfully published message <paho.mqtt.client.Client object at 0xb64e6330>, None, 13
Dec 21 18:59:21 raspberrypizero DEBUG - [MqttConnection] Published message 18 to sensor_reporter/heartbeat/num retain=False
Dec 21 18:59:21 raspberrypizero DEBUG - [MqttConnection] on_publish: Successfully published message <paho.mqtt.client.Client object at 0xb64e6330>, None, 14
Dec 21 18:59:21 raspberrypizero DEBUG - [MqttConnection] Published message 00:00:00 to sensor_reporter/heartbeat/str retain=False
Dec 21 19:00:21 raspberrypizero DEBUG - [MqttConnection] on_publish: Successfully published message <paho.mqtt.client.Client object at 0xb64e6330>, None, 15
Dec 21 19:00:21 raspberrypizero DEBUG - [MqttConnection] Published message 60122 to sensor_reporter/heartbeat/num retain=False
Dec 21 19:00:21 raspberrypizero DEBUG - [MqttConnection] on_publish: Successfully published message <paho.mqtt.client.Client object at 0xb64e6330>, None, 16
Dec 21 19:00:21 raspberrypizero DEBUG - [MqttConnection] Published message 00:01:00 to sensor_reporter/heartbeat/str retain=False
Dec 21 19:01:21 raspberrypizero DEBUG - [MqttConnection] on_publish: Successfully published message <paho.mqtt.client.Client object at 0xb64e6330>, None, 17
Dec 21 19:01:21 raspberrypizero DEBUG - [MqttConnection] Published message 120224 to sensor_reporter/heartbeat/num retain=False
Dec 21 19:01:21 raspberrypizero DEBUG - [MqttConnection] on_publish: Successfully published message <paho.mqtt.client.Client object at 0xb64e6330>, None, 18
Dec 21 19:01:21 raspberrypizero DEBUG - [MqttConnection] Published message 00:02:00 to sensor_reporter/heartbeat/str retain=False