Apologies if I'm not understanding the API stuff in the docs, but I was wondering if zwave2mqtt itself has an HTTP API that can be called to toggle stuff like switches on/off without another application, e.g. home assistant?
Or alternatively, is there any way of limiting the data sent to application like HomeAssistant? I.e. only send the status of a switch instead of all the other entities like alarm_type, alarm_level, heat, sourcenodeid, etc?
Nope there is no http api for that. Only MQTT and sockets
Could add this to TODOs
With the existing API, is there a way to refresh a single node?
What you mean with refresh ? refreshNodeInfo ? If so yes, just use MQTT apis, check readme
What you mean with
refresh?refreshNodeInfo? If so yes, just use MQTT apis, check readme
The README states
Refresh Node Info: Enable this to automatically call refreshNodeInfo api against all nodes to force all nodes refreshing their configuration
This looks like it will refreshNodeInfo for ALL nodes. I only want to do this for 1 node. Is that possible?
EDIT: I am guessing this might be it? - zwave.refreshNodeInfo(nodeid); ?
Oh that is a settings in zwave. But If you go in the control panel you will see that there is an action that you can send to a specific node, the signature is refreshNodeInfo(nodeid) so it will have just nodeid as arg
Going back to my request, what I was hoping for was a way of toggling switches/fetching node states without having to make HomeAssistant handle it all for me. An HTTP request to get the status of a light that I poll and another to toggle it on/off was what I'd aim for. However, I'm not really up to speed on mqtt yet, so I may be talking impossibilities/nonsense. I just figured as you can toggle on/off via the zwave2mqtt UI that it might be relatively simple to replicate via an http request.
If this is something that's possible and you can point me in the right starting direction, it's probably something I could work on.
Maybe that is it. Not sure but what I am looking to do is tell the node to update its status/info and tell the controller. In Homeassistant native OZW integration I can ask a node to update its info via zwave.refresh_node. The node would then tell the controller its most up to date information such as state. That is what I'd like to do with z2m but the only way to do that is via the control panel. Not API or command line that I am aware. HTTP API would b useful there. To @djdd87 point, having the ability to make simple calls would really simplify other apps and remote hosts in using z2m.
@djdd87 The UI sends command to the backend using sockets. You can use sockets like I do in the frontend or just check out mqtt :)
@edif30 Eveything you are asking right now could be done using MQTT or sockets. For http apis I need to make the support
@robertsLando Could I be cheeky and ask you to point me at an example of the sockets stuff within the repo?
Socket events: https://github.com/OpenZWave/Zwave2Mqtt/blob/master/src/App.vue#L170
SOcket actions: https://github.com/OpenZWave/Zwave2Mqtt/blob/master/src/App.vue#L180
Socket listeners:
https://github.com/OpenZWave/Zwave2Mqtt/blob/master/src/App.vue#L205
https://github.com/OpenZWave/Zwave2Mqtt/blob/master/src/components/ControlPanel.vue#L1085
Call zwave api: https://github.com/OpenZWave/Zwave2Mqtt/blob/master/src/components/ControlPanel.vue#L806
In the end I managed to achieve everything I wanted with mqtt sensors and switches without the HASS integration. Everything's working brilliantly - thank you very much. As I don't require this any more, feel free to close it unless you think it'll add value to the project.
@djdd87 That is the raccomended way. This project is born as zwave mqtt gateway, hass integration is difficut and easily breaks with hass updates
Oh that is a settings in zwave. But If you go in the control panel you will see that there is an action that you can send to a specific node, the signature is
refreshNodeInfo(nodeid)so it will have just nodeid as arg
Fine - is it posible to get a example to call refreshNodeInfo(nodeid) out from NODE-RED? i try a lot of thinks but get only message: "Unknown API"
Thank you
BR
Hubertus
i do it, may be a have a misunderstanding in build the json
msg.topic = "Z2M/_CLIENTS/ZWAVE_GATEWAY-Zwave2Mqtt/api/RefreshNodeInfo/set"
msg.payload set as json in a change node = {"args":[13]}
RefreshNodeInfo --> refreshNodeInfo
Thank you - damn - this works fine. Sorry for that.
@HubertusH no worries :)