Closed stevemac00 closed 7 years ago
@stevemac00 look at the documentation https://github.com/cflurin/homebridge-mqtt#add-service
and for setting https://github.com/cflurin/homebridge-mqtt#set-value-to-homebridge
I'm not getting how that documents sending multiple service values with one payload?
Well, this isn't supported, you have to send each value individually.
A node-red example for netatmo:
var msg1 = {"topic":"netatmo", "payload": {}};
msg1.payload = {"name":"netatmo",
"service_name":"outdoor_temp",
"characteristic":"CurrentTemperature",
"value":msg.payload.externalTemperature};
node.send(msg1);
msg1.payload = {"name":"netatmo",
"service_name":"indoor_temp",
"characteristic":"CurrentTemperature",
"value":msg.payload.temperature};
node.send(msg1);
msg1.payload = {"name":"netatmo",
"service_name":"outdoor_humidity",
"characteristic":"CurrentRelativeHumidity",
"value":msg.payload.externalHumidity};
node.send(msg1);
msg1.payload = {"name":"netatmo",
"service_name":"indoor_humidity",
"characteristic":"CurrentRelativeHumidity",
"value":msg.payload.humidity};
node.send(msg1);
msg1.payload = {"name":"netatmo",
"service_name":"indoor_co2",
"characteristic":"CarbonDioxideLevel",
"value":msg.payload.co2};
node.send(msg1);
msg1.payload = {"name":"netatmo",
"service_name":"outdoor_pressure",
"characteristic":"CurrentAirPressure",
"value":msg.payload.pressure};
node.send(msg1);
return null;
It's not clear to me how to handle multi-service devices. The simplest example being a humidity/temperature sensor (although a thermostat would have many more services and characteristics).
Intuitively, I'd pass a list to add like:
{'services': [{'service_name': 'Temperature', 'service': 'TemperatureSensor'}, {'service_name': 'Humidity', 'service': 'HumiditySensor'}], 'name': 'Master Bath'}
then update values similarly but the plug-in throws an "invalid JSON format" error. So now I currently have to send each payload separately.Can you document how to handle adding and sending values for this simple example? Then I can figure out more complicated devices like my thermostats.