I put together one of the add-on for HA OS that might interest you. It not only sets up the entities in HA, with a small bit of config from you, but even integrates them into a "device" in HA too, so the various entities for your door sensor (such as the contact sensor, the timestamp sensor, battery sensor, etc) all show up as a single "device" in HA.
The repo to add for the add-on is here.
To configure a DSC device, you need to view the output in MQTT with MQTT Explorer. You'll need just a few pieces of info to add to the add-on config to create a device.
In the add-on config, you'll add something like this, with an entry for each device:
devices: - manufacturer: DSC-Security model: WS4904P name: Foyer Motion Sensor type: motion uid: '3688899'
So for this device, you need to put, exactly, what you see in MQTT Explorer for it. Manufacturer is from MQTT and the uid is also directly from MQTT explorer, as seen here: https://i.imgur.com/JpiDiWE.png
Name is arbitrary, you can name it whatever makes sense for your device. Type must match precisely one of the following types: "motion", "contact", "glassbreak", "temp_hum_c", "temp_hum_f", "temp_hum_c_to_f", "temp_hum_f_to_c", or "sonoff_remote".
Model is also arbitrary. I use what's printed on the back of my physical devices. But you could make it anything.
Yup, login to your MQTT broker with MQTT Explorer.
Publish to this toplc: (changing DEVICE_FRIENDLY_NAME to your light's friendly name in z2m)
>zigbee2mqtt/DEVICE_FRIENDLY_NAME/set
with this payload:
>{"read": {"cluster": "lightingColorCtrl", "attributes": ["colorTempPhysicalMin", "colorTempPhysicalMax"]}}
That will run the command and the results will be in the z2m logs.
running the portable version now, thank you for this!! ... seems that zoneminder isn't talking to mosquitto at all, yet. which helps narrow down my issue, and helps with some great understanding... thank you!
I am glad to hear that! Also, thanks for the tip! I'll try to disable the LED later (currently my setup is hidden within a TV table, therefore it's not so annoying).
So far I have 6 services defined in a docker-compose.yml file, which gives me so much comfort. I am planning to add and try MQTT Explorer. It's a great advantage to have everything in one place. The entire configuration is also stored in GitLab, so there is no need to worry about losing or migrating the services (I've successfully migrated from Raspberry Pi to Intel NUC).
Since the services work within an internal docker network, it's quite independent of a host PC.
You don't seem to have any error checking in yout code. Firstly, i'd look at whether it managed to connect successfully. Looking at the source here there seems to be a didConnectAck method for that.
Also there's no username or password being set in the code. Does your server need that?
MQTT Explorer can be useful to monitor your MQTT messages.
There is also some example code here. I haven't tried it so no idea if it's any use.
Hope that gives you some pointers.