matapan Posted December 12, 2022 Share Posted December 12, 2022 Apologies in advance if this question is answered somewhere in existing documentation or post. I want to keep as much of the primary scripting control within the ISY. To that end, I plan to use the ISY's REST interface to set or get device states in Home Assistant using ISY variables as a placeholder for devices not supported in the ISY that are in HA. That said, what is the mechanism in HA in an automation script for taking the state of a non-ISY supported device and setting the value of a variable representing the state of that device in the ISY? Assuming it's some sort of curl script, how would this be specified in a HA automation script? Link to comment
MrBill Posted December 12, 2022 Share Posted December 12, 2022 1) load the Universal-devices integration in HA. 2) (recommended, not required) Click on Configuration for that Integration and change the "Variable Sensor String" from HA. to .HA The default seems to be a prefix, but I prefer a suffix to the variable name for HA to read the state Off-topic note: I also change the "Ignore String" from the default {IGNORE ME} to a simple ~ 3) rename ISY variables including the "Variable Sensor String" 4) Now restart HA or Reload the Universal Devices integration. These identified variables will now appear as entities in HA. If they change on the ISY side they will also change on the HA side To drive a value change from HA to the ISY use Call Service - isy994.set_variable you can practice live and/or identify the format needed for complex YAML but using HA "Developer Tools" in the left menu bar and the Services tab. (example: fill out the form and press the Call Service button to test, when it works switch to YAML mode to see the YAML version of the filled form. Basically you specify: Either a variable type and variable ID number OR a variable name. (note if using names variable names must be unique and the name space covers both Integer and State Variable. The value that you want to set. optionally: Set Init to true to change the ISY's Init value optionally: if you have multiple ISY's it's possible to specify the target ISY. Additionally understand that its also very easy to run ISY programs directly from HA. For example, I created ISY programs to control my fireplace (like a thermostat but there's no actual thermostat) The set-point exists as an ISY State variable. Buttons on my HA dashboard include ^ and v (up and down carets) Pressing Up caret calls RUN THEN and pressing Down caret is RUN ELSE (there is no IF in this, it just simply an HA helper program on the ISY. Keep in mind the name space for program names consists of the program name only and not its preceding folder structure. So more importantly program names that will be called from HA must be unique. In the preceding example, consider this ISY program structure: +--Fireplaces +-- Upstairs +--up.TempSetButtons +--(other upstairs fireplace programs) +--(other upstairs fireplace programs) +--(other upstairs fireplace programs) +-- Downstairs +--dn.TempSetButtons +--(other downstairs fireplace programs) +--(other downstairs fireplace programs) +--(other downstairs fireplace programs) Note that we had to carefully name up.TempSetButtons and dn.TempSetButtons because we need unique names irrespective of folder structure to use in HA CALL SERVICE - ISY994 Send Program Command and again use Developer Tools in HA for live practice and syntax. 5 Link to comment
matapan Posted December 13, 2022 Author Share Posted December 13, 2022 Thanks for pointing me in the right direction Mr. Bill! 1 Link to comment
MrBill Posted December 16, 2022 Share Posted December 16, 2022 @matapan I didn't think to include an example automation that keeps an ISY variable up to date, this one sets outdoor air temp monitored by HA to an ISY variable. This automation sets both the current value and the init value for the ISY. alias: "AAA Weatherflow: Air Temp -> ISY" description: "" trigger: - platform: state entity_id: - sensor.weatherflow_air_temperature condition: [] action: - service: isy994.set_variable data: name: sWeatherFlow.OutdoorAirTemp value: "{{ states('sensor.weatherflow_air_temperature') | int }}" - service: isy994.set_variable data: value: "{{ states('sensor.weatherflow_air_temperature') | int }}" name: sWeatherFlow.OutdoorAirTemp init: true mode: single Use the Developer Tools > Template editor in HA to work out the value: string in real time. I only push to ISY values that I need for use in an ISY program. 1 Link to comment
Recommended Posts