Hello
For more flexibility I try to move the Alexa support for my Domoticz
from HA-bridge (on RPi2) to NodeRed (on RPi3B+). On the new RPi3 is running:
Domoticz, Mosquitto as MQTT broker and NodeRed. All are runnig fine and work together.
I have exported and imported the Domoticz configuration from RPi2 to RPi3. So I have
an test environment on the RPi3 but!! without attached Zwave controller and RFXCom.
I see an different behavior:
if press on :8080/#/LightSwitches testlampe -> on I get: Error sending switch command, check device/hardware (idx=724) !
(correct because the RFXCom is not connected) but:
if I say "Alexa switch testlampe on" the bulb symbol :8080/#/LightSwitches changed to on (no hardware error hint).
In NodeRed I see from Domoticz:out :
{
"Battery" : 255,
"LastUpdate" : "2022-02-09 22:38:36",
"RSSI" : 12,
"description" : "",
"dtype" : "Light/Switch",
"hwid" : "4",
"id" : "00014324",
"idx" : 724,
"name" : "testlampe",
"nvalue" : 1,
"stype" : "Switch",
"svalue1" : "0",
"switchType" : "On/Off",
"unit" : 1
}
from Alexa I got:
powerState: "ON"
source: "alexa"
directive: "TurnOn"
name: "testlampe"
type: "SWITCH"
rawDirective: object
In a function node in NodeRed I translate name: "testlampe" to IDX and powerState: to "nvalue" and send the
payload via MQTT to Domoticz:in
switch (msg.payload.powerState)
{
case "ON":
msg.payload = {"idx":724,"nvalue":1,"svalue":"0"};
break;
case "OFF":
msg.payload = {"idx":724,"nvalue":0,"svalue":"0"};
break;
}
return msg;
As described above: only the bulb symbol changed, no real switch command initated.
My question is: which of the in Domoticz:out recorded values are necessary to send to Domoticz
to initiate a switchcommand and where I can found the values (for the other devices) in Domoticz?
Moving Alexa support from HA-bridge to NodeRed (node-red-contrib-virtual-smart-home)
Moderator: leecollings
- waltervl
- Posts: 5910
- Joined: Monday 28 January 2019 18:48
- Target OS: Linux
- Domoticz version: 2024.7
- Location: NL
- Contact:
Re: Moving Alexa support from HA-bridge to NodeRed (node-red-contrib-virtual-smart-home)
Check the wiki page https://www.domoticz.com/wiki/MQTT#MQTT_to_Domoticz
Domoticz running on Udoo X86 (on Ubuntu)
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
Devices/plugins: ZigbeeforDomoticz (with Xiaomi, Ikea, Tuya devices), Nefit Easy, Midea Airco, Omnik Solar, Goodwe Solar
- FireWizard
- Posts: 1905
- Joined: Tuesday 25 December 2018 12:11
- Target OS: Raspberry Pi / ODroid
- Domoticz version: Beta
- Location: Voorthuizen (NL)
- Contact:
Re: Moving Alexa support from HA-bridge to NodeRed (node-red-contrib-virtual-smart-home)
Hello @burkhard
Your Node-RED flow looks okay, except the command sent to Domoticz.
Add the "command":"switchcmd" to your JSON string.
The "command" defaults to "udevice". So if you omit the "command" then it defaults to "udevice" and it will update the Domoticz device.
This is exactly what happens.
So change:
msg.payload = {"idx":724,"nvalue":1,"svalue":"0"}; into
msg.payload = {"command":"switchcmd","idx":724,"nvalue":1,"svalue":"0"};
and also
msg.payload = {"idx":724,"nvalue":0,"svalue":"0"}; into
msg.payload = {"command":"switchcmd","idx":724,"nvalue":0,"svalue":"0"};
Regards
Your Node-RED flow looks okay, except the command sent to Domoticz.
Add the "command":"switchcmd" to your JSON string.
The "command" defaults to "udevice". So if you omit the "command" then it defaults to "udevice" and it will update the Domoticz device.
This is exactly what happens.
So change:
msg.payload = {"idx":724,"nvalue":1,"svalue":"0"}; into
msg.payload = {"command":"switchcmd","idx":724,"nvalue":1,"svalue":"0"};
and also
msg.payload = {"idx":724,"nvalue":0,"svalue":"0"}; into
msg.payload = {"command":"switchcmd","idx":724,"nvalue":0,"svalue":"0"};
Regards
-
- Posts: 2
- Joined: Tuesday 08 January 2019 9:57
- Target OS: Raspberry Pi / ODroid
- Domoticz version:
- Contact:
Re: Moving Alexa support from HA-bridge to NodeRed (node-red-contrib-virtual-smart-home)
Thanks to FireWizard and waltervl
This was to easy - I was blind ....
Regards Burkhard
This was to easy - I was blind ....
Regards Burkhard
Who is online
Users browsing this forum: No registered users and 1 guest