/
MQTT - Integration FHEM
MQTT - Integration FHEM
Zunächst wird ein Gerät vom Typ MQTT2_CLIENT (https://fhem.de/commandref.html#MQTT_CLIENT), mit Port 61894 in FHEM angelegt um sich mit der NWPM Touch zu verbinden.
defmod nwpm_mqtt_client MQTT2_CLIENT 192.168.178.38:61894
attr nwpm_mqtt_client clientId nwpm_mqtt_client
attr nwpm_mqtt_client mqttVersion 3.1.1
attr nwpm_mqtt_client subscriptions gateway/iothub/twin_reported_state extern/nwpm_mqtt_client/#
attr nwpm_mqtt_client username mqtt
attr nwpm_mqtt_client verbose 5
Anschließend wird ein Gerät vom Typ MQTT2_DEVICE angelegt, dass die Wärmepumpe darstellt.
defmod nwpm_mqtt_device MQTT2_DEVICE
attr nwpm_mqtt_device IODev nwpm_mqtt_client
attr nwpm_mqtt_device getList modbus_get modbus_get_result gateway/modbus/get_value/$EVTPART1 {"name":"$EVTPART1","mqtt_msg_properties":{"response_topic":"extern/nwpm_mqtt_client/get_value_reply/$EVTPART1","correlation_data": 0}}
attr nwpm_mqtt_device readingList nwpm_mqtt_client:gateway/iothub/twin_reported_state:.* twin_reported_state\ nwpm_mqtt_client:gateway/iothub/twin_reported_state:.* { json2nameValue($EVENT) }\ nwpm_mqtt_client:extern/nwpm_mqtt_client/get_value_reply/.*:.* modbus_get_result
attr nwpm_mqtt_device setList modbus_set gateway/modbus/set_value/$EVTPART1 {"name":"$EVTPART1","value":["$EVTPART2"],"mqtt_msg_properties":{"response_topic":"","correlation_data": 0}}\ modbus_set_multiple gateway/modbus/set_value/$EVTPART1 {"name":"$EVTPART1","value":$EVTPART2,"mqtt_msg_properties":{"response_topic":"","correlation_data": 0}}