Open kkellner opened 4 years ago
This is likely documented someplace but was unable to find the Blue Iris API documentation on the topic. I found a forum post with this information:
Up to 99 macros are supported by Blue Iris and may be edited using this http command...
/admin?macro=x&text={text} Set macro number x=1-99 to value {text}
Note that {text} must contain only url-acceptable characters.
For example, a space must be %20, etc.
Files may also be assigned, e,g.,
&text=file:/C:\Blue%20Iris\My%20Overlays\bit\test.txt
Use this command to clear a macro...
/admin?macro=x&text=
How do you suggest the user will do that?
Well this is how I'm doing it the manual way:
sensor:
- platform: template
sensors:
blueiris_url:
value_template: "{{ state_attr('camera.blueiris_all_cameras', 'stream_source')|regex_findall_index(find='^(.*)\/h264', index=0, ignorecase=False) }}"
blueiris_token:
value_template: "{{ state_attr('camera.blueiris_all_cameras', 'access_token') }}"
blueiris_session:
value_template: "{{ state_attr('camera.blueiris_all_cameras', 'stream_source')|regex_findall_index(find='session=([^&]*)', index=0, ignorecase=False) }}"
blueiris_weather_overlay:
value_template: "{{ state_attr('weather.dark_sky', 'temperature') }}F%20{{ state_attr('weather.dark_sky', 'wind_speed')|round(0) }}mph"
# Set Blue Iris Macro overlay value from passed in values of macro_id and macro_text
shell_command:
blueiris_set_macro: "curl -HL 'Authorization: Basic {{states('sensor.blueiris_token')}}' '{{states('sensor.blueiris_url')}}/admin?macro={{macro_id}}&text={{macro_text}}&session={{states('sensor.blueiris_session')}}'"
automation:
- alias: Update Blue Iris Weather Overlay
trigger:
- platform: state
entity_id: sensor.blueiris_weather_overlay
action:
- service: shell_command.blueiris_set_macro
data_template:
macro_id: 1
macro_text: "{{states('sensor.blueiris_weather_overlay')}}"
The idea is if blue iris add-on contained a service called camera.set_macro
(example) that took two params, macro_id
and macro_text
, then user can call via:
- service: camera.set_macro
data:
macro_id: 1
macro_text: "Hello World!"
Or a more real example is to get a value from a sensor (e.g., weather) and update the camera macro:
- service: camera.set_macro
data_template:
macro_id: 1
macro_text: "{{states('sensor.blueiris_weather_overlay')}}"
This would eliminate all the "glue" code I have above under sensor
and shell_command
Enhancement request
Allow update of Blue Iris macro values (%1-%99) through HA Blue Iris integration.
Use Case
I would like to display HA data as a video overlay via Blue Iris macros. For example current temperature. Historically this has been done by creating a text file on the Blue Iris server and defining the macro as
file://C:\temp\video_weather.txt
(for example). However that requires additional effort to push this file to the Blue Iris server. The ability to call a HA service (provided by this Blue Iris integration) to push data values to Blue Iris Macros would be ideal.Documentation reference
On page 163 of https://blueirissoftware.com/BlueIris.PDF It states:
I have found no other information on the HTTP/JSON API on how to do this.