Skip to content

Commit

Permalink
fix sensortype (#1010)
Browse files Browse the repository at this point in the history
* fix typo

* fix connection error because of api version

* RDM002

* rdm002

* update mqtt sensor

* fix sensor type
  • Loading branch information
hendriksen-mark authored Mar 20, 2024
1 parent 4ba7a27 commit d638bf3
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions BridgeEmulator/services/mqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@
"RDM002": {
"dataConversion": {
"rootKey": "action",
"dirKey": "action_direction",
"typeKey": "action_type",
"timeKey": "action_time",
"button_1_press": {"buttonevent": 1000},
"button_1_hold": {"buttonevent": 1001},
"button_1_press_release": {"buttonevent": 1002},
Expand Down Expand Up @@ -301,9 +304,9 @@ def on_message(client, userdata, msg):
if getObject(key["friendly_name"]) == False: ## Add the new sensor
logging.info("MQTT: Add new mqtt sensor " + key["friendly_name"])
if key["model_id"] in standardSensors:
for sensor in sensorTypes[key["model_id"]].keys():
for sensor_type in sensorTypes[key["model_id"]].keys():
new_sensor_id = nextFreeId(bridgeConfig, "sensors")
sensor_type = sensorTypes[key["model_id"]][sensor]
#sensor_type = sensorTypes[key["model_id"]][sensor]
uniqueid = convertHexToMac(key["ieee_address"]) + "-01-1000"
sensorData = {"name": key["friendly_name"], "protocol": "mqtt", "modelid": key["model_id"], "type": sensor_type, "uniqueid": uniqueid,"protocol_cfg": {"friendly_name": key["friendly_name"], "ieeeAddr": key["ieee_address"], "model": key["definition"]["model"]}, "id_v1": new_sensor_id}
bridgeConfig["sensors"][new_sensor_id] = HueObjects.Sensor(sensorData)
Expand Down

0 comments on commit d638bf3

Please sign in to comment.