Updating text through MQTT [solved]
Moderator: leecollings
- rbisschops
- Posts: 63
- Joined: Monday 12 May 2014 11:20
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2.2563
- Location: Schiedam, Netherlands
- Contact:
Updating text through MQTT [solved]
Hi all,
Probably a simple question, but i’m strugling with it.
What is the json string I need to create and push through MQTT to update a text dummy text sensor with a new text?
Thx
Ralph
Probably a simple question, but i’m strugling with it.
What is the json string I need to create and push through MQTT to update a text dummy text sensor with a new text?
Thx
Ralph
Last edited by rbisschops on Wednesday 13 June 2018 22:27, edited 1 time in total.
RPi 3B (master): RFXtrx433, Harmony Hub, Z-Wave devices, CoCo units, Hue, Xiaomi Aquara
RPi 2B (slave): P1 connection, MySensors with custom built watermeter sensors on Aquadis+
RPi’s with: Mosquitto MQTT, Home Bridge, Home Assistant (for evaluation only)
RPi 2B (slave): P1 connection, MySensors with custom built watermeter sensors on Aquadis+
RPi’s with: Mosquitto MQTT, Home Bridge, Home Assistant (for evaluation only)
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Updating text through MQTT
from this wiki pagerbisschops wrote: ↑Tuesday 12 June 2018 22:46 ...
What is the json string I need to create and push through MQTT to update a text dummy text sensor with a new text?
http://domoticzIP:domoticzPORT//json.htm?type=command¶m=udevice&idx=IDX&nvalue=0&svalue=TEXT
IDX = id of your device (This number can be found in the devices tab in the column "IDX")
TEXT = Text you want to display
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
- rbisschops
- Posts: 63
- Joined: Monday 12 May 2014 11:20
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2.2563
- Location: Schiedam, Netherlands
- Contact:
Re: Updating text through MQTT
Thx @waaren, but thagt is not what I'm looking for. I found and tried the API call from a browser. This is working fine. I want to push the data through MQTT, so I need to create a JSON string. I tried:waaren wrote: ↑Tuesday 12 June 2018 23:19from this wiki pagerbisschops wrote: ↑Tuesday 12 June 2018 22:46 ...
What is the json string I need to create and push through MQTT to update a text dummy text sensor with a new text?
http://domoticzIP:domoticzPORT//json.htm?type=command¶m=udevice&idx=IDX&nvalue=0&svalue=TEXT
IDX = id of your device (This number can be found in the devices tab in the column "IDX")
TEXT = Text you want to display
Code: Select all
{"text":"home","idx":229}
Code: Select all
{"svalue":"home","idx":229}
Code: Select all
{"data":"home","idx":229}
Thx
Ralph
RPi 3B (master): RFXtrx433, Harmony Hub, Z-Wave devices, CoCo units, Hue, Xiaomi Aquara
RPi 2B (slave): P1 connection, MySensors with custom built watermeter sensors on Aquadis+
RPi’s with: Mosquitto MQTT, Home Bridge, Home Assistant (for evaluation only)
RPi 2B (slave): P1 connection, MySensors with custom built watermeter sensors on Aquadis+
RPi’s with: Mosquitto MQTT, Home Bridge, Home Assistant (for evaluation only)
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: Updating text through MQTT
maybe this will help
from old topic on this forum
from old topic on this forum
I think you mean: mosquitto_pub -h 192.168.1.120 -t 'domoticz/in' -m '{"command": "udevice", "idx": 19, "svalue": "Test Test Test"}'
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
-
- Posts: 138
- Joined: Thursday 01 May 2014 9:01
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Netherlands - Sittard
- Contact:
Re: Updating text through MQTT
The correct syntax is indeed:
{"command": "udevice", "idx": nnn, "svalue": "your text"}
I use a NodeRed function to update my location (latitude in this example) to a text sensor and there I use:
{"command": "udevice", "idx": nnn, "svalue": "your text"}
I use a NodeRed function to update my location (latitude in this example) to a text sensor and there I use:
Code: Select all
msg.payload = {"command": "udevice", "idx": nnn, "svalue": String(msg.payload.lat)};
- rbisschops
- Posts: 63
- Joined: Monday 12 May 2014 11:20
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2.2563
- Location: Schiedam, Netherlands
- Contact:
Re: Updating text through MQTT
Thx @waaren and @D'rMorris for the anwers,
however it does not seem to work. I'm also using NodeRed. It creates:
However when pushed to Domoticz/in, nothing happens.
I dubble checked the idx twice.
For reference, this:
works perfectly. Its in the same NodeRed flow as the text change above. So imho the flow from NodeRed to Domoticz works.
Edit: For reference, I'm on the last stable version: 3.8153
What am I overlooking here?
Thx again!
Ralph
however it does not seem to work. I'm also using NodeRed. It creates:
Code: Select all
{"command":"udevice","idx":229,"svalue":"unknown"}
I dubble checked the idx twice.
For reference, this:
Code: Select all
{"command":"switchlight","idx":218,"switchcmd":"On"}
Edit: For reference, I'm on the last stable version: 3.8153
What am I overlooking here?
Thx again!
Ralph
RPi 3B (master): RFXtrx433, Harmony Hub, Z-Wave devices, CoCo units, Hue, Xiaomi Aquara
RPi 2B (slave): P1 connection, MySensors with custom built watermeter sensors on Aquadis+
RPi’s with: Mosquitto MQTT, Home Bridge, Home Assistant (for evaluation only)
RPi 2B (slave): P1 connection, MySensors with custom built watermeter sensors on Aquadis+
RPi’s with: Mosquitto MQTT, Home Bridge, Home Assistant (for evaluation only)
-
- Posts: 138
- Joined: Thursday 01 May 2014 9:01
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Netherlands - Sittard
- Contact:
Re: Updating text through MQTT
What happens if you update the text sensor first with an normal URL JSON?
As reference, this is my script in NodeRed:
I'm also runinng the stable version.
Just to be sure: you are sending data to domoticz/in (all lowercase) right? Perhaps you can create an inject input, then a script function and then the MQTT output and a debug node? And then try to debug this way?
As reference, this is my script in NodeRed:
Code: Select all
msg.payload = {"command": "udevice", "idx": nnn, "svalue": "test")};
return msg;
Just to be sure: you are sending data to domoticz/in (all lowercase) right? Perhaps you can create an inject input, then a script function and then the MQTT output and a debug node? And then try to debug this way?
- rbisschops
- Posts: 63
- Joined: Monday 12 May 2014 11:20
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2.2563
- Location: Schiedam, Netherlands
- Contact:
Re: Updating text through MQTT
@D'rMorris sometimes life is simple and an error easily overlooked. domoticz/in instead of Domoticz/in was thé golden tip!
Thx!!
Ralph
Thx!!
Ralph
RPi 3B (master): RFXtrx433, Harmony Hub, Z-Wave devices, CoCo units, Hue, Xiaomi Aquara
RPi 2B (slave): P1 connection, MySensors with custom built watermeter sensors on Aquadis+
RPi’s with: Mosquitto MQTT, Home Bridge, Home Assistant (for evaluation only)
RPi 2B (slave): P1 connection, MySensors with custom built watermeter sensors on Aquadis+
RPi’s with: Mosquitto MQTT, Home Bridge, Home Assistant (for evaluation only)
-
- Posts: 138
- Joined: Thursday 01 May 2014 9:01
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Location: Netherlands - Sittard
- Contact:
Re: Updating text through MQTT [solved]
Very welcome, glad you got it sorted out! Since the other flow was working, do you have multiple MQTT configutations defined? I have only 1 domoticz/in configuration and all my flows use that one.rbisschops wrote:@D'rMorris sometimes life is simple and an error easily overlooked. domoticz/in instead of Domoticz/in was thé golden tip!
Thx!!
Ralph
- rbisschops
- Posts: 63
- Joined: Monday 12 May 2014 11:20
- Target OS: Raspberry Pi / ODroid
- Domoticz version: 2.2563
- Location: Schiedam, Netherlands
- Contact:
Re: Updating text through MQTT [solved]
Same with me, I only use domoticz/in. As mentioned before, I also use NodeRed and a Mosquitto broker on a (separate) Pi. For now I mainly pull in Owntracks positioning information for my "anyone at home" scenario's.D'rMorris wrote: ↑Thursday 14 June 2018 6:42Very welcome, glad you got it sorted out! Since the other flow was working, do you have multiple MQTT configutations defined? I have only 1 domoticz/in configuration and all my flows use that one.rbisschops wrote:@D'rMorris sometimes life is simple and an error easily overlooked. domoticz/in instead of Domoticz/in was thé golden tip!
Thx!!
Ralph
RPi 3B (master): RFXtrx433, Harmony Hub, Z-Wave devices, CoCo units, Hue, Xiaomi Aquara
RPi 2B (slave): P1 connection, MySensors with custom built watermeter sensors on Aquadis+
RPi’s with: Mosquitto MQTT, Home Bridge, Home Assistant (for evaluation only)
RPi 2B (slave): P1 connection, MySensors with custom built watermeter sensors on Aquadis+
RPi’s with: Mosquitto MQTT, Home Bridge, Home Assistant (for evaluation only)
Who is online
Users browsing this forum: No registered users and 1 guest