MQTT: given new state is NULL, couldn't post update


#1

I’m having a problem setting the state on switches, numbers seem fine.

topic: hestia/local/heatingstate with any value (including 1, 0, ON and OFF) always results in a “given new state is NULL, couldn’t post update” error and nothing changing.

Anyone have any ideas?


#2

Do you have the binary.map file in the transform directory ?
here


#3

Yep. I’ve also messed with the permissions, tried a new file, checked map addon is installed etc.


#4

Compare with my permission (some irrelevant files have been omitted)

pi@raspberrypi:~ $ ls -la /etc/openhab2/*
/etc/openhab2/items:
total 20
drwxrwxrwx  2 openhab openhab 4096 Nov 23 23:07 .
drwxr-xr-x 13 openhab openhab 4096 Oct 13 00:03 ..
-rwxrwxrwx  1 root    root    5388 Nov 23 23:07 default.items
-rw-rw-r--  1 openhab openhab  231 May 28  2018 readme.txt

/etc/openhab2/persistence:
total 16
drwxrwxrwx  2 openhab openhab 4096 Nov 23 23:41 .
drwxr-xr-x 13 openhab openhab 4096 Oct 13 00:03 ..
-rw-rw-r--  1 openhab openhab  256 May 28  2018 readme.txt
-rwxrwxrwx  1 root    root     294 Nov 23 22:40 rrd4j.persist

/etc/openhab2/rules:
total 36
drwxrwxrwx  2 openhab openhab  4096 Nov 24 09:27 .
drwxr-xr-x 13 openhab openhab  4096 Oct 13 00:03 ..
-rw-r--r--  1 pi      root    23984 Nov 25 23:00 default.rules
-rw-rw-r--  1 openhab openhab   223 May 28  2018 readme.txt

/etc/openhab2/services:
total 36
drwxr-xr-x  2 openhab openhab 4096 Oct 13 00:52 .
drwxr-xr-x 13 openhab openhab 4096 Oct 13 00:03 ..
-rw-rw-r--  1 openhab openhab 2269 May 28  2018 addons.cfg
-rw-r--r--  1 openhab openhab  465 Oct 13 00:12 http.cfg
-rw-r--r--  1 openhab openhab 1589 Oct 13 00:51 mqtt.cfg
-rw-r--r--  1 openhab openhab 1465 Oct 13 00:12 mqtt-eventbus.cfg
-rw-rw-r--  1 openhab openhab  333 May 28  2018 readme.txt
-rw-r--r--  1 openhab openhab  527 Oct 13 00:12 rrd4j.cfg
-rw-rw-r--  1 openhab openhab 2986 May 28  2018 runtime.cfg

/etc/openhab2/sitemaps:
total 16
drwxrwxrwx  2 openhab openhab 4096 Nov 23 23:08 .
drwxr-xr-x 13 openhab openhab 4096 Oct 13 00:03 ..
-rwxrwxrwx  1 root    root    2623 Nov 23 23:08 default.sitemap
-rw-rw-r--  1 openhab openhab  241 May 28  2018 readme.txt

/etc/openhab2/things:
total 16
drwxr-xr-x  2 openhab openhab 4096 Nov 23 22:40 .
drwxr-xr-x 13 openhab openhab 4096 Oct 13 00:03 ..
-rwxrwxrwx  1 root    root    1294 Nov 23 22:40 default.things
-rw-rw-r--  1 openhab openhab  234 May 28  2018 readme.txt

/etc/openhab2/transform:
total 28
drwxrwxrwx  2 openhab openhab 4096 Nov 23 23:14 .
drwxr-xr-x 13 openhab openhab 4096 Oct 13 00:03 ..
-rwxrwxrwx  1 root    root      32 Nov 23 22:40 binary.map
-rw-rw-r--  1 openhab openhab   38 May 28  2018 de.map
-rw-rw-r--  1 openhab openhab   38 May 28  2018 en.map
-rw-rw-r--  1 openhab openhab  282 May 28  2018 readme.txt

#5

Are we talking about code from our Git repo or your own? Did you try

MainSwitch.sendCommand("OFF")

instead of .postUpdate()?


#6

Code is up to date with repo. Seems setting the HeatingPin23 was not the right thing to set however and that the MainSwitch error is irrelevant (as this came from the openhab script on HeatingMode change). Adding MQTT code to HeatingMode is achieving what I wanted (ability to turn the HestiaPI heating on and off.

So this is effectively fixed, but I’m wondering why the MQTT code is on the HeatingPin23 rather than the HeatingMode considering the former seems to not really do anything alongside the HestiaPI?


#7

because MQTT is applied here on HeatingPin23 as a way to control an external contact for the heating (direction >)
Adding another topic on HeatingMode is the way to go :wink: