btreinders Posted April 12, 2022 Posted April 12, 2022 (edited) Does anyone know how to get a sensor value from HA to the ISY? I see a binary sensor but nothing that would allow the ISY get the actual value of the sensor data. Or can the ISY subscribe to an MQTT topic? Either way would work for what I need to do. Thanks! Edited April 12, 2022 by btreinders
MrBill Posted April 12, 2022 Posted April 12, 2022 you can create an automation on the HA side. the trigger is when the sensor changes. then for the action: Call Service, Universal Devices ISY994 Set Variable. Type 2 = state (if you want the ISY to react). You can either use "Name" or "Variable Address" to identify the variable, but not both. Here's an example of an automation that allows the ISY to close the barn door (which is actually controlled by HA). It updates in this case an integer variable that also triggers this program. So the logic flow is --> ISY wants to open (1) or Close (-1) the overhead barn door, the variable iDoor_BarnOHDbutton_ActionRequest_ha gets set to 1 or -1 --> HA sees the variable as sensor: entity_id: sensor.idoor_barnohdbutton_actionrequest_ha because of the naming convention ending in _ha --> The automation is watch for the value to change, Since the value is set to -1 it's "below 0" -- HA first calls the service to Close the door (cover), then it calls the ISY set variable service to set the same integer variable back to 0, and get it ready for the next request. (there is a second HA automation, I'll paste it as well, that does more or less the same thing so that the ISY can open the barn door when the same variable is set to +1). alias: Barn OHD Close description: '' trigger: - platform: numeric_state entity_id: sensor.idoor_barnohdbutton_actionrequest_ha below: '0' condition: [] action: - service: cover.close_cover target: entity_id: cover.barn_2 data: {} - service: isy994.set_variable data: type: 1 address: 51 value: 0 mode: single NOTE: I didn't have a problem finding the sensor entity as expected, I did have trouble setting Variable via "name" and simply opted to set it by variable "number" instead integer variable 51 is indeed iDoor_BarnOHDbutton_ActionRequest_ha which is in turn entity_id: sensor.idoor_barnohdbutton_actionrequest_ha the open automation: alias: Barn OHD Open description: '' trigger: - platform: numeric_state entity_id: sensor.idoor_barnohdbutton_actionrequest_ha above: '0' condition: [] action: - service: cover.open_cover target: entity_id: cover.barn_2 data: {} - service: isy994.set_variable data: type: 1 value: 0 address: 51 mode: single Hope that help you figure out how to handle your need. ?
btreinders Posted April 12, 2022 Author Posted April 12, 2022 @MrBill Thank you for the answer! I do have an automation which looks for a sensor value to change but what I want to do is then send that change (which is an integer ranging from 0 to almost 4000) to the ISY so I don't know what to put in the value: line. So if the sensor changes to 345 then send 345 to the ISY variable. In the GUI for the ISY service it only allows integers 0-255 and not a sensor value. It will not let me put a name in there. The yaml will but I have no idea what to put in there.
shbatm Posted April 13, 2022 Posted April 13, 2022 You should be able to use a template in the service call, something like: value: "{{ states('sensor.entity_id') | int}}"
btreinders Posted April 13, 2022 Author Posted April 13, 2022 2 hours ago, shbatm said: You should be able to use a template in the service call, something like: value: "{{ states('sensor.entity_id') | int}}" That worked! Thank you so much!
MrBill Posted April 13, 2022 Posted April 13, 2022 Heh, I've been meaning to teach myself templates for a long time. I arrived at the same answer and was headed back to post an example. At any rate I'm happy you asked the question, because it pushed me over the edge of the cliff to go learn about to use templates. ? I picked this sensor because it has a large value that changes every few minutes. alias: 'TEST adguard DNS ' description: '' trigger: - platform: state entity_id: sensor.adguard_dns_queries condition: [] action: - service: isy994.set_variable data: type: 2 address: 38 value: '{{ states('sensor.adguard_dns_queries') }}' mode: single
Recommended Posts