schmupu / ioBroker.lupusec

Adapter for Lupusec alarm system
MIT License
12 stars 4 forks source link

Power Switch MQTT JSON Error #59

Open MacAgent opened 1 year ago

MacAgent commented 1 year ago

Describe the bug
Since latest update to Adapter version 1.3.6 the Power Switch integration into MQTT is broken. Switching On/Off from MQTT is working Switching On/Off from Device or Lupusec App/Web via MQTT is not working.

To Reproduce
Steps to reproduce the behavior:

  1. Go to physical device and push the button
  2. Click on Lupusec XT2 (0.0.3.5R) WebApp on sesnor power switch
  3. Scroll down in Logs:

mqtt-client.0 | 2023-03-29 14:08:36.697 | debug | successfully published lupusec.0.devices.ZS:xxx001.status_ex: {"topic":"lupusec/0/devices/ZS:xxx001/status_ex","message":"true"} mqtt-client.0 | 2023-03-29 14:08:36.696 | debug | publishing lupusec.0.devices.ZS:xxx001.status_ex

  1. See error in mosquitto.log

Screenshots & Logfiles 13:42:21.738 MQTT IN: lupusec/0/devices/ZS:xxx001/status_ex: false 13:42:21.739 Expanding json message 13:42:21.739 Error on JSON expansion: Inappropriate ioctl for device 13:42:21.739 All data filtered - skipping further processing of this message

Versions:

Additional context
none

greetings Jacques

schmupu commented 1 year ago

You have to set the ack flag to false in the MQTT payload. Please check if you send true/false as boolean and not as string.

Example: onStateChange lupusec.0.devices.ZS:aXXXX.status_ex: {"val": true, "ack": false} or onStateChange lupusec.0.devices.ZS:aXXXX.status_ex: {"val": false, "ack": false}

image

Does it work now?

MacAgent commented 1 year ago

Hi,

I do not realy get the poitn here. Where could I make this changes? I cann still see this in IOBROKERS Log: Object of state "lupusec.0.devices.ZS:9be001.status_ex" is missing the required property "common.type"

Where can I add this missing property?

Here is what I have

image

and this

image

image

Whar ever option I use, the mosquitto.log still show:

09:04:54.712 MQTT IN: lupusec/0/devices/ZS:9be001/status_ex: true 09:04:54.713 Expanding json message 09:04:54.713 Error on JSON expansion: Inappropriate ioctl for device 09:04:54.714 All data filtered - skipping further processing of this message

MacAgent commented 1 year ago

FYI: my setup

on a PI4 I have iobroker running beside of Loxberry 3.0.0.2 MQTT Server is part of the LB3.0 and communicating with a LOXONE Miniserver Gen.1 On iobroker the MQTT-Client and the Lupusec adapters and many others like Daikin, Shelly, Unifi etc... are installed Many of them are configured to use mqtt-client.0 and everything is working as expected, except the Lupusec Power Switches. All other Lupus devices are fine too. Like f.ex. the more complex configured Heating Valves.

Please advice where I should made this changes

Thanks

schmupu commented 1 year ago

The Lupusec adapter or Lupuscec alarm system needs not an extra property with the name ack. It does not exsist. If you change states in ioBroker, for example you want to set lupusec.0.devices.ZS:9be001.status_ex to the boolean value false. You can tell ioBroker to set the value with ack false or ack true. For the changing Lupusec Adapter states you must always set ioBroker states with ack false. You can change all ioBroker states for all iobroker adapters with *ack false/true.

If you change a value of a Lupusec adapter state in ioBroker by MQTT the payload of the MQTT Message has to be like this: {"val": _my_newvalue, "ack": false}

for example, turn power on lupusec.0.devices.ZS:aXXXX.status_ex = {"val": true, "ack": false}

for example, change the name of the socket to "socket kitchen" lupusec.0.devices.ZS:aXXXX.name = {"val": "socket kitchen", "ack": false}

It is not an error in the Lupuscec adapter. I checked it with MQTT (see screenshots) and it works great with MQTT.

MacAgent commented 1 year ago

Hello, (back from holiday)

I'm sorry, but I do not realy understand where I have to change this values!

I deleted the whole Lupusec Object Tree and removed and reinstalled the Lupusec Adapter. All my Lupusec Door and Windows and Motion sensors are working again, but when I push the button on a Power Switch I still see this error in the mqttgateway.log

09:10:58.258 MQTT IN: lupusec/0/devices/ZS:9be001/status_ex: true 09:10:58.259 Expanding json message 09:10:58.259 Error on JSON expansion: Inappropriate ioctl for device 09:10:58.260 All data filtered - skipping further processing of this message

This is working image

Power Off lupusec/0/devices/ZS:9be001/status_ex = 0 Power On lupusec/0/devices/ZS:9be001/status_ex = 1

this was working for the last few years and is still working with MQTT-Explorer

What and where do I have to make this changes to get it working again?

schmupu commented 1 year ago

You do not have to install the MQTT or Lupusec adapter new. They are totally okay! If you want to set (publish) the state bei MQTT, you have to send (publish) the JSON {"val": true, "ack": false} and not 1 or true to turn the power on. In your screenshot, you are sending 1 or 0 instead of {"val": true, "ack": false} or {"val": false, "ack": false}

Setting (publishing) state by MQTT (for example with MQTT-Explorer) correct:

lupusec/0/devices/ZS:9be001/status_ex = {"val": true, "ack": false}
lupusec/0/devices/ZS:9be001/status_ex = {"val": fasle, "ack": false}

incorrect

lupusec/0/devices/ZS:9be001/status_ex = 1
lupusec/0/devices/ZS:9be001/status_ex = 0
lupusec/0/devices/ZS:9be001/status_ex = true
lupusec/0/devices/ZS:9be001/status_ex = false
lupusec/0/devices/ZS:9be001/status_ex = "true"
lupusec/0/devices/ZS:9be001/status_ex = "false"

if you receive the sates in MQTT (for example in MQTT Explorer), you will get the states true or false for lupusec/0/devices/ZS:9be001/status_ex back in MQTT Explorer. It is a litte bit confusing, that states look different for receiving and sending states.

MacAgent commented 1 year ago

I’m sorry, but it seams that we don’t get the right point here.Maybe my English is to bad, I agree.In normal operation it’s not me sending any MQTT messages, it’s your adapter sending this messages. And this messages lead to the error in the mqttgateway.logI did just activate sending MQTT messages on lupusec/0/devices/ZS:9be001/status_ex as shown in the screenshot that’s all. And when I physically push the button on the switch I receive this error messages in the mqtt log. How could I change the format off the mqtt message? Anyhow I found a two solutions and my power switches are working again.1. Publish the lupusec/0/devices/ZS:9be001/status_ex as Object is working, but have some other side effects which I didn’t want. So I undo this change.2. To turn off JSON expansion on the MQTT Broker(Server). This leads to the working solution where I’m not forced to change everything after the message was send.You can close this issue if you want, but for me there must be something “wrong” in the adapter which I don’t understand and I just cannot explain it clearly enough to you of cause.Greetings JacquesPS: please don’t misunderstand! The adapter is GREAT and I’m very thankful and appreciate your work and it’s working fine for a lot other MQTT messages… except for the power switch 😜On 8 Apr 2023, at 06:43, Thorsten Stueben @.***> wrote: You do not have to install the MQTT or Lupusec adapter new. They are totally okay! If you want to set the state bei MQTT, you have to send the JSON {"val": true, "ack": false} and not 1 or true to turn the power on. In your screenshot, you are sending 1 or 0 instead of {"val": true, "ack": false} or {"val": false, "ack": false} Setting state by MQTT (for example with MQTT-Explorer) correct: lupusec/0/devices/ZS:9be001/status_ex = {"val": true, "ack": false} lupusec/0/devices/ZS:9be001/status_ex = {"val": fasle, "ack": false}

incorrect lupusec/0/devices/ZS:9be001/status_ex = 1 lupusec/0/devices/ZS:9be001/status_ex = 0 lupusec/0/devices/ZS:9be001/status_ex = true lupusec/0/devices/ZS:9be001/status_ex = false lupusec/0/devices/ZS:9be001/status_ex = "true" lupusec/0/devices/ZS:9be001/status_ex = "false"

if you receive the sates in MQTT (for example in MQTT Explorer), you will get the states true or false for lupusec/0/devices/ZS:9be001/status_ex back in MQTT Explorer. It is a litte bit confusing, that states look different for receiving and sending states.

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

schmupu commented 1 year ago

Wenn ich Dich richtig verstehe, bekommst Du keinen Fehler in ioBroker angezeigt? Das Logfile sieht gut aus? Welche Anwendung gibt Dir genau den Fehler? Mosquitto.?

MacAgent commented 1 year ago

Hallo,

Doch ich sehe im iobroker Log folgendes: Object of state "lupusec.0.devices.ZS:9be001.status_ex" is missing the required property "common.type" Und die JSON Fehler sehe ich danach im /opt/loxberry/log/system_tmpfs/mqttgateway.log

Um das zusätzlich noch zu Erwähnen: Das schalten des Schalter funktioniert sehr wohl auch mit

lupusec/0/devices/ZS:9be001/status_ex = {"val": true, "ack": false} lupusec/0/devices/ZS:9be001/status_ex = {"val": false, "ack": false} und mit lupusec/0/devices/ZS:9be001/status_ex = 1 lupusec/0/devices/ZS:9be001/status_ex = 0 lupusec/0/devices/ZS:9be001/status_ex = true lupusec/0/devices/ZS:9be001/status_ex = false lupusec/0/devices/ZS:9be001/status_ex = "true" lupusec/0/devices/ZS:9be001/status_ex = "false"

Nur wenn ich den Schalter am Power Switch selbst betätige, bekomme ich nach dem nächsten Pollen im iobroker Log und im Mosquitto Log die genannten Fehler.

Mein MQTT Server ist der von LOXBERRY 3.0 integrierte und Iobroker läuft auf dem gleichen PI4. Auf dem iobroker ist nur der MQTT Client Adapter installiert. Und wie gesagt, ich habe nur die aller nötigste Konfiguration vorgenommen. Also MQTT Server, Port, Username, Password. Im Lupusec Objekt lupusec/0/devices/ZS:9be001/status_ex MQTT Enbled Das sieht man ob im Screenshot.

Ich bin bis jetzt davon ausgegangen, dass bis vor dem letzten Lupusec Adapter Update alles reibungslos funktionierte. Da bin ich mir aber heute nicht mehr so ganz sicher, denn eine Woche vorher hatte ich auch von Loxberry 2 auf 3 upgegraded, und natürlich habe ich danach nicht alle Funktionen bis ins kleinste Detail überprüft. Mir ist erst nach dem Lupusec Adapter update aufgefallen, dass es nicht mehr funktioniert, es könnte aber auch durchaus sein dass nach LB3.0 Update nicht mehr funktioniert hat und es mir nur nicht aufgefallen ist.

Also Sorry für das Durcheinander.

VG