Closed MarsWarrior closed 5 years ago
I have no time to implement it right now, If you want to submit a PR I can review it.
My idea is to start from zigbee2mqtt homeassistant gateway and customize it for zwave, the homeassistan gateway will work like the normal one and will subscribe to mqtt and zwave events like:
mqtt.on('writeRequest', onWriteRequest.bind(this))
mqtt.on('broadcastRequest', onBroadRequest.bind(this))
mqtt.on('apiCall', onApiRequest.bind(this))
zwave.on('valueChanged', onValueChanged.bind(this))
zwave.on('nodeStatus', onNodeStatus.bind(this))
zwave.on('scanComplete', onScanComplete.bind(this))
I would love this too!
I'm releasing a first beta version of hass integration today, any beta tester available here?
I'd be happy to try out the Hass integration
@jshridha Check last commit
Just a random question (maybe more appropriate for the HASS guys, idk much about mqtt and this auto discovery). Say I have a multifunction device, like a combined temp/light/movement/humidity sensor - Does that mean that hass must also have exactly the same device type to support all those features on my device? When I look at the "sensors" entry on the hass website, seems it only supports a "single" sensor type?
Just a random question (maybe more appropriate for the HASS guys, idk much about mqtt and this auto discovery). Say I have a multifunction device, like a combined temp/light/movement/humidity sensor - Does that mean that hass must also have exactly the same device type to support all those features on my device? When I look at the "sensors" entry on the hass website, seems it only supports a "single" sensor type?
In your case you get - depending on how the discovery by zwave2mqtt is done - a temp, light, movement and humidity sensor, all from the same device!
Ok. Good to know. Then how about a bit more of a convoluted example.
A Wall Switch with a Power Meter? (Eg, W, amps, voltage, Kw/h etc)
So it’s a “switch and a sensor”?
Yes Justin... I’m working to support thermostats (climate) and fans too on Zwave2mqtt, maybe this evening or next week there will be a first working version
Daniel
On 12 Jul 2019, at 12:09, Justin Hammond notifications@github.com wrote:
Ok. Good to know. Then how about a bit more of a convoluted example.
A Wall Switch with a Power Meter? (Eg, W, amps, voltage, Kw/h etc)
So it’s a “switch and a sensor”?
— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub, or mute the thread.
@MarsWarrior Could you do some tests with the latest version from master ?
@robertsLando I'm not seeing any of the devices show up in home assistant yet. I'm monitoring the mqtt traffic and it looks like it is only publishing the changes under the specified prefix topic and it appears it's not publishing under the prefix topic with the correct format for hass discovery. Below is my configuration and mqtt traffic seen.
Can you let me know if my configuration is correct?
Could you check if there is any error in console log? Are you using latest version from master? Please set the payload type to json time value or entire zeave object in configuration. Also what kind of zwave device do you have in your network?
Daniel
On 14 Jul 2019, at 20:57, Jay notifications@github.com wrote:
@robertsLando I'm not seeing any of the devices show up in home assistant yet. I'm monitoring the mqtt traffic and it looks like it is only publishing the changes under the specified prefix topic and it appears it's not publishing under the prefix topic with the correct format for hass discovery. Below is my configuration and mqtt traffic seen.
Can you let me know if my configuration is correct?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
I did not see any errors in the console. I am using the latest commit. I built the docker image from scratch changing the hash to match the latest commit. I am using GE switches, GE/Jasco light dimmers, and first alert CO/smoke detectors.
I changed to json time value and entire zwave object, but I I'm still not seeing the hass-formatted messages.
Are you sure you don’t see anything publishing in
Daniel
On 15 Jul 2019, at 05:18, Jay notifications@github.com wrote:
I did not see any errors in the console. I am using the latest commit. I built the docker image from scratch changing the hash to match the latest commit. I am using GE switches, GE/Jasco light dimmers, and first alert CO/smoke detectors.
I changed to json time value and entire zwave object, but I I'm still not seeing the hass-formatted messages.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
@jshridha I have found a wrong loop that caused disovery to break. Could you check it now with latest commit please?
@robertsLando It's looking better. It looks like the sensors are being sent to the right topic. However, the light dimmers and fans are being shown up under the "cover" category instead of "light" and "fan" (see image below).
I have not yet tested if sending commands works correctly or if they show up in the hass interface correctly. I've only been monitoring the traffic so far.
As an additional feature, would be be possible to specify an alternative topic that homeassistant commands be sent to? Currently all updates (Zwave2Mqtt formatted and hass formatted) are going to the same topic. This will put additional load on the hass server since it's parsing messages it does not need to parse.
I've tried running it (commit 042cace4d39c7e7477c26cb79fcadff45af9dbee) but when I enable Hass Discovery
it crashes for me
@awulf Try now, it was a typo :)
@jshridha Unfortunally I haven't any light dimmer or fans to test but I will try to make some changes in code. Could you send me there an example discovery payload for a dimmer and a fan to take inspiration?
Really thanks
@robertsLando I don't have a payload for fans, but this is an example from a zigbee light switch that was sent by zigbee2mqtt:
topic: homeassistant/light/0x90fd9ffffe0d2bfe/light/config
{
"brightness": true,
"color_temp": true,
"schema": "json",
"command_topic": "zigbee2mqtt/Master Bedroom Lamp - Jay/set",
"state_topic": "zigbee2mqtt/Master Bedroom Lamp - Jay",
"name": "Master Bedroom Lamp - Jay_light",
"unique_id": "0x90fd9ffffe0d2bfe_light_zigbee2mqtt",
"device": {
"identifiers": "zigbee2mqtt_0x90fd9ffffe0d2bfe",
"name": "Master Bedroom Lamp - Jay",
"sw_version": "Zigbee2mqtt 1.4.0",
"model": "TRADFRI LED bulb E26/E27 980 lumen, dimmable, white spectrum, opal white (LED1545G12)",
"manufacturer": "IKEA"
},
"availability_topic": "zigbee2mqtt/bridge/state"
}
@jshridha Check with latest commit e0662f74a959a16cfc4c58982293c2888102674a
@jshridha could you also join the slack chat? There we can chat faster https://join.slack.com/t/zwave2mqtt/shared_invite/enQtNjc4NjgyNjc3NDI2LTc3OGQzYmJlZDIzZTJhMzUzZWQ3M2Q3NThmMjY5MGY1MTc4NjFiOWZhZWE5YjNmNGE0OWRjZjJiMjliZGQyYmU
@MarsWarrior Could you do some tests with the latest version from master ?
As soon as my z-wave stick functions again I will join testing. Currently no z-wave network anymore 😢
My z-wave network consists of only 230V power switching and power measuring nodes btw. All other stuff is WiFi and Zigbee (lights, switches, temp/humi sensors).
@MarsWarrior No worries thanks anyway :) If you want to join the slack channel you are welcome
Thanks @robertsLando I got it running now, but looks like the discovery topics are being sent to the prefix set for zwave2mqtt, rather than the homeassistant
prefix.
@awulf The prefix used is the one specified in mqtt settings :) Change that one or the one in hass configutration to be the same
@robertsLando It would be great if that was a user-customizable topic. That way hass isn't parsing unnecessary topics (e.g. "Study", "Theatre", "Living Room", etc from @awulf 's example above)
Yeah would be good if the prefix for discovery is user customisable (and defaulting to 'homeassistant'). As you can see on the screenshot the other subscribers (such as zigbee2mqtt) do it this way.
I found a bug where often the "Device HASS JSON" would be a mixture of the device you select and the last device in my list of devices. E.g. selecting the Garage Door switch shows the Bedroom 2 light switch (image attached). The discovery JSON in MQTT explorer is showing up correctly. I have been trying to change the JSON for the Garage Door from "switch" to "cover" but haven't been able to save it. No errors in the logs.
I'm releasing a patch version 2.0.1 with a little fix
So will add a feature for discovery prefix too
@jshridha @awulf Available in 2.0.1
Excited to try this out in the coming weeks! I can't wait until Home Assistant isn't dealing with Z-Wave anymore and a) I can move it onto another server and b) move z-wave to something that'll never get restarted and it'll hopefully keep the z-wave network rock solid! Thanks @robertsLando !
Just had another go at using it, when trying to modify the Hass Device JSON
, no matter what I put in (not even changing it) it will go red, shake and say JSON test failed
Happens on both one 2.0.1 and the latest master.
I'm trying to get the garage door to become a cover
rather than a switch
. Home Assistant's built in Z-wave sees it as that, but Zwave2mqtt doesn't.
@awulf You can ignore the red JSON test failed. What is happening is after you hit the "update" button, the text box is cleared out. Since it's clear now, the input is no longer valid. After you click on the hass device again, you'll see the updated JSON and then you can click on "rediscover" to send the MQTT discovery message.
Have tried that, and it does temporarily work. But when I reboot zwave2mqtt it goes back to the default.
Yes that's right. I think ti's meant to be a troubleshooting/discovery tool. It's not persistent.
@awulf to make it persistent you need to press "STORE" button at the top of hass devices table
I have made a simple tutorial to try out ZWAVE2MQTT add-on in Home Assistant:
Add MQTT to Home Assistant
I installed add-on Mosquito broker and added mqtt:
https://www.home-assistant.io/components/mqtt/ with discovery: true
https://www.home-assistant.io/docs/mqtt/discovery/ to configuration.yaml
mqtt:
broker: core-mosquitto
username: !secret mqtt_username
password: !secret mqtt_password
discovery: true
Install ZWAVE2MQTT add-on, (Optional: open port to 8091
or change to your needs)
Delete Zwave integration and remove zwave:
config from configuration.yaml
(for quick test, you can just stop zwave network in zwave panel, but this is not recommended, because cause problems after HA restart)
Start ZWAVE2MQTT, open web ui, and setup the add-on
In Zwave settings setup Serial Port
(Mine is /dev/ttyACM0
, same as for Zwave integration. Setup Poll Interval
(Mine is 60000
millis, dont know if is correct for 15 nodes).
In MQTT settings setup Name
(zwave
), Host url
- mqtt broker address (my_domain.duckdns.org
), Port
(mqtt port, mine is 1883
), Reconnect peroid
(mine is 60000
, think it will do), Prefix
(default is homeassistant
to be discovered), enable Retain
and Auth
, and add there your mqtt username
and password
.
In Gateway settings setup Type
(ValueID topic
) and Payload
(Entire Z-wave value Object
) and enable Hass Discovery
.
Go to Control Panel and the controller with powered nodes should appear, for battery nodes must wait to be wake up or wake them.
The zwave nodes are now in mqtt integration and have new entity names in Home Assistant.
Motion sensors are created as _contact
sensor with open/closed. In Home Assistant they are as door sensor. So you must customize device in customize.yaml
:
binary_sensor.*_contact:
icon: mdi:walk
device_class: motion
(10.) If you want go back to Zwave integration, stop ZWAVE2MQTT add-on, start zwave network or enable back zwave integration and restart Home Assistant. Everything should be back again.
(11.) If you decide to stay, replace old entities with new entities in your setup(sensors, automations,…). You can also rename new entities with names from old zwave integration.
Please add your opinions, correcture,…
@joselito11 - Tried this but the UI doesn’t seem to accept the toggles when I change them.
Here is an example showing it changing back every time I change the state
https://www.dropbox.com/s/lo2h6fo80fjloib/RPReplay_Final1564143522.MP4?dl=0
I had the same issue (the delayed toggle). What happened to me was that OZW was still starting up (it can take 10 minutes for me) and it was queueing up messages, but the state on MQTT was synced back to the last-known state for the device even while the change appeared to be queued to send. If I waited a little while, it would get sent. If I got impatient then I got some rubber-banding on the toggle (off-on-off-on-off-on etc.).
A different issue than the above: my motion sensors (binary) get imported as contact/door sensors instead of motion/motion. Easy to fix in HASS, but also a PITA when you have a lot of them.
Similarly, a voltage sensor came in as air volume or something similarly odd.
@ahknight YOu can fix this easily by set the correct device class in gateway values table.
@joselito11 Thanks for the tutorial. I'm closing this issue as now it is supported. Open new issue for device specific problems
I see in your todo list that integration (discovery I assume) with home assistant is planned.
Can you tell me when you think to build this functionality?
I am already using zigbee2mqtt, so a big fan of mqtt and would be very happy if full integration with the device registry of home assistant is implemented for z-wave!