Closed Achronite closed 5 months ago
@Achronite Don't we already have this?
var discoveryTopic = `${CONFIG.discovery_prefix}${parameter.component}/ener314rt/${object_id}/config`;
// var dmsg = Object.assign({ uniq_id: `${unique_id}`, "~": `${CONFIG.topic_stub}`, name: `${name}`, mf: 'energenie', sw: 'mqtt-ener314rt' },
var dmsg = Object.assign({
device: {
name: `${device_name}`,
ids: [`ener314rt-${device.deviceId}`],
mdl: `${device_defaults.mdl} (${device_defaults.mdlpn}) [${device.deviceId}]`,
mf: `Energenie`,
sw: `mqtt-ener314rt ${APP_VERSION}`
},
uniq_id: `${unique_id}`,
"~": `${CONFIG.topic_stub}${device.productId}/${device.deviceId}/`,
name: `${entity_name}`,
avty_t: `${CONFIG.topic_stub}availability/state`,
o: {
name: `mqtt-energenie-ener314rt`,
sw: `${APP_VERSION}`,
url: `https://github.com/Achronite/mqtt-energenie-ener314rt`
}
}
But to be fair, have you seen the way Zigbee2MQTT do it? It's quite nice.
Note how the name is null.
Topic: homeassistant/light/0x000b57fffebdce17/light/config
{
"availability": [
{
"topic": "zigbee2mqtt/bridge/state",
"value_template": "{{ value_json.state }}"
},
{
"topic": "zigbee2mqtt/Dining Room 1/availability",
"value_template": "{{ value_json.state }}"
}
],
"availability_mode": "all",
"brightness": true,
"brightness_scale": 254,
"command_topic": "zigbee2mqtt/Dining Room 1/set",
"device": {
"identifiers": [
"zigbee2mqtt_0x000b57fffebdce17"
],
"manufacturer": "IKEA",
"model": "TRADFRI LED bulb GU10 400 lumen, dimmable (LED1650R5)",
"name": "Dining Room 1",
"sw_version": "2.3.094",
"via_device": "zigbee2mqtt_bridge_0x00124b00257cb246"
},
"effect": true,
"effect_list": [
"blink",
"breathe",
"okay",
"channel_change",
"finish_effect",
"stop_effect"
],
"name": null,
"object_id": "dining_room_1",
"origin": {
"name": "Zigbee2MQTT",
"sw": "1.35.2",
"url": "https://www.zigbee2mqtt.io"
},
"schema": "json",
"state_topic": "zigbee2mqtt/Dining Room 1",
"unique_id": "0x000b57fffebdce17_light_zigbee2mqtt"
}
@genestealer What do you think?
@Achronite Looks really great. A few things which may be worth considering:
Shutdown Pi
button to controls - To command the Pi to shutdown before removing power, rather than having to remote into the Pi to shut it down.Restart Pi
button (same as above) but restart.Software Version
as a Diagnostic sensor.For ref the Zigbee2MQTT Bridge debug info:
Zigbee2MQTT Bridge Connection state (binary_sensor.zigbee2mqtt_bridge_connection_state)
MQTT discovery data:
Topic: homeassistant/binary_sensor/1221051039810110150109113116116_0x00124b00257cb246/connection_state/config
Payload
device:
hw_version: zStack3x0 20221226
identifiers:
- zigbee2mqtt_bridge_0x00124b00257cb246
manufacturer: Zigbee2MQTT
model: Bridge
name: Zigbee2MQTT Bridge
sw_version: 1.35.3
device_class: connectivity
entity_category: diagnostic
name: Connection state
object_id: zigbee2mqtt_bridge_connection_state
origin:
name: Zigbee2MQTT
sw_version: 1.35.3
support_url: https://www.zigbee2mqtt.io
payload_off: offline
payload_on: online
state_topic: zigbee2mqtt/bridge/state
unique_id: bridge_0x00124b00257cb246_connection_state_zigbee2mqtt
value_template: '{{ value_json.state }}'
platform: mqtt
FULL MQTT debug info for ref:
1. Add a `Shutdown Pi` button to controls - To command the Pi to shutdown before removing power, rather than having to remote into the Pi to shut it down.
I don't think it is a good idea, even if possible, to shutdown the O/S safely from within a running application.
2. Add a `Restart Pi` button (same as above) but restart.
(see above) + Maybe a restart of the application could be possible, by exiting it. The systemctrl service could restart it.
3. Add `Software Version` as a Diagnostic sensor.
Backlog; it is already shown in the device entry.
4. I'm not sure why the logbook on the right is not hyperlinking to the device. (See image example)
No idea how they did this; it has limited value anyway?
Anyways; I've just released this code for you to try. It doesn't need a newer energenie-ener314rt C code version.
@Achronite Control Pi Power: Ah, yes it may have issues if it lacks sudo powers, I will have to create something else to do it. I used to have the option when I used the node-red version, which was handy to shutdown the Pi from my phone before unplugging the power cable.
Hyperlinking: No idea, I hoped the text I copied in the last comment may have helped shed some light on it. But the text may still be handy for referencing to as zigbee2mqtt is a huge project which uses MQTT discovery, so can pull on their examples.
New version to try, I assume this is the https://github.com/Achronite/mqtt-energenie-ener314rt/tree/develop
New version to try, I assume this is the https://github.com/Achronite/mqtt-energenie-ener314rt/tree/develop
Yep
Updated the examples too, I decided on still grouping the ENER002s under 'ook' these can also be added. I kept the devices with multiple controls together, hence the '4 gang':
New version to try, I assume this is the https://github.com/Achronite/mqtt-energenie-ener314rt/tree/develop
Yep
Updated the examples too, I decided on still grouping the ENER002s under 'ook' these can also be added. I kept the devices with multiple controls together, hence the '4 gang':
@Achronite can we set this OOK/4-gang naming/grouping convection via a boolean value in the config to avoid me having to keep a fork with the "vanilla style" home assistant architecture?
Huh? It's only whats listed in the README and your own HA yaml files
@Achronite Ops, sorry ignore me, I forgot we set the OOK/4-gang naming/grouping convection via manual YAML code and not via auto-discovery! No need for me to keep a fork.
So it's working great! Great work 😁 I can see the ENER314-RT Bridge on the MQTT Device list in Home Assistant
It's hyper-linking on that screenshot... Did you restart HA?
@Achronite
No restart, but I am running the latest HA version.
Should the eTRV's show up at some point on the connected devices,
@Achronite I was impatient, eTRV's are showing
For HA MQTT Discovery make use of the via_device entry to create a device / sub-device hierarchy within the device registry.
The device 'mqtt-energenie-ener314rt' should have:
Also remember to update the manually configured devices too in README