IR Sensor/Blaster with HA



  • Looking into MyMessage.h I see that
    S_IR = 20, //!< IR device, V_IR_SEND, V_IR_RECEIVE
    also I downloaded a sample sketch from here https://www.mysensors.org/build/ir
    and saw that they changed V_IR_SEND to V_IR_RECEIVE.
    I tried with both and still HA doesn't recognize the IR sensor.
    Here is the debug log.
    16-12-30 02:44:21 homeassistant.core: Bus:Handling <Event component_loaded[L]: component=logger>
    16-12-30 02:44:22 homeassistant.bootstrap: Setting up discovery
    16-12-30 02:44:22 homeassistant.core: Bus:Handling <Event component_loaded[L]: component=discovery>
    16-12-30 02:44:22 homeassistant.bootstrap: Setting up http
    16-12-30 02:44:22 homeassistant.core: Bus:Handling <Event component_loaded[L]: component=http>
    16-12-30 02:44:22 homeassistant.bootstrap: Setting up mqtt
    16-12-30 02:44:22 homeassistant.core: Bus:Handling <Event service_registered[L]: service=publish, domain=mqtt>
    16-12-30 02:44:22 homeassistant.core: Bus:Handling <Event component_loaded[L]: component=mqtt>
    16-12-30 02:44:22 homeassistant.bootstrap: Setting up api
    16-12-30 02:44:22 homeassistant.core: Bus:Handling <Event component_loaded[L]: component=api>
    16-12-30 02:44:22 homeassistant.bootstrap: Setting up websocket_api
    16-12-30 02:44:22 homeassistant.core: Bus:Handling <Event component_loaded[L]: component=websocket_api>
    16-12-30 02:44:22 homeassistant.bootstrap: Setting up frontend
    16-12-30 02:44:22 homeassistant.core: Bus:Handling <Event component_loaded[L]: component=frontend>
    16-12-30 02:44:22 homeassistant.bootstrap: Setting up logbook
    16-12-30 02:44:22 homeassistant.core: Bus:Handling <Event service_registered[L]: service=log, domain=logbook>
    16-12-30 02:44:22 homeassistant.core: Bus:Handling <Event component_loaded[L]: component=logbook>
    16-12-30 02:44:22 homeassistant.loader: Loaded sensor.yr from homeassistant.components.sensor.yr
    16-12-30 02:44:22 homeassistant.bootstrap: Setting up sensor
    16-12-30 02:44:22 homeassistant.components.sensor: Setting up sensor.yr
    16-12-30 02:44:22 homeassistant.core: Bus:Handling <Event state_changed[L]: entity_id=sensor.yr_symbol, old_state=None, new_state=<state sensor.yr_symbol=unknown; friendly_name=yr Symbol, attribution=Weather forecast from yr.no, delivered by the Norwegian Meteorological Institute and the NRK., entity_picture=//api.met.no/weatherapi/weathericon/1.1/?symbol=None;content_type=image/png @ 2016-12-29T21:44:22.475972-05:00>>
    16-12-30 02:44:23 homeassistant.core: Bus:Handling <Event state_changed[L]: entity_id=sensor.yr_symbol, old_state=<state sensor.yr_symbol=unknown; friendly_name=yr Symbol, attribution=Weather forecast from yr.no, delivered by the Norwegian Meteorological Institute and the NRK., entity_picture=//api.met.no/weatherapi/weathericon/1.1/?symbol=None;content_type=image/png @ 2016-12-29T21:44:22.475972-05:00>, new_state=<state sensor.yr_symbol=1; friendly_name=yr Symbol, attribution=Weather forecast from yr.no, delivered by the Norwegian Meteorological Institute and the NRK., entity_picture=//api.met.no/weatherapi/weathericon/1.1/?symbol=1;content_type=image/png @ 2016-12-29T21:44:23.485807-05:00>>
    16-12-30 02:44:23 homeassistant.core: Bus:Handling <Event component_loaded[L]: component=sensor>
    16-12-30 02:44:23 homeassistant.bootstrap: Setting up updater
    16-12-30 02:44:23 homeassistant.core: Bus:Handling <Event component_loaded[L]: component=updater>
    16-12-30 02:44:23 homeassistant.bootstrap: Setting up conversation
    16-12-30 02:44:23 homeassistant.core: Bus:Handling <Event service_registered[L]: service=process, domain=conversation>
    16-12-30 02:44:23 homeassistant.core: Bus:Handling <Event component_loaded[L]: component=conversation>
    16-12-30 02:44:23 homeassistant.loader: Loaded tts.google from homeassistant.components.tts.google
    16-12-30 02:44:23 homeassistant.bootstrap: Setting up tts
    16-12-30 02:44:23 homeassistant.core: Bus:Handling <Event service_registered[L]: service=google_say, domain=tts>
    16-12-30 02:44:23 homeassistant.core: Bus:Handling <Event service_registered[L]: service=clear_cache, domain=tts>
    16-12-30 02:44:23 homeassistant.core: Bus:Handling <Event component_loaded[L]: component=tts>
    16-12-30 02:44:23 homeassistant.bootstrap: Setting up sun
    16-12-30 02:44:23 homeassistant.core: Bus:Handling <Event state_changed[L]: entity_id=sun.sun, old_state=None, new_state=<state sun.sun=below_horizon; elevation=0, next_setting=2016-12-30T22:36:51+00:00, azimuth=0, friendly_name=Sun, next_rising=2016-12-30T12:42:08+00:00 @ 2016-12-29T21:44:23.839549-05:00>>
    16-12-30 02:44:23 homeassistant.core: Bus:Handling <Event component_loaded[L]: component=sun>
    16-12-30 02:44:23 homeassistant.bootstrap: Setting up history
    16-12-30 02:44:23 homeassistant.core: Bus:Handling <Event component_loaded[L]: component=history>
    16-12-30 02:44:23 homeassistant.bootstrap: Setting up mysensors
    16-12-30 02:44:23 mysensors.mysensors: Subscribing to: mysensors-out/5/2/1/+/+
    16-12-30 02:44:23 mysensors.mysensors: Subscribing to: mysensors-out/5/2/2/+/+
    16-12-30 02:44:23 mysensors.mysensors: Subscribing to: mysensors-out/5/+/4/+/+
    16-12-30 02:44:23 homeassistant.core: Bus:Handling <Event component_loaded[L]: component=mysensors>
    16-12-30 02:44:23 homeassistant.core: Bus:Handling <Event platform_discovered[L]: discovered=, platform=mysensors, service=load_platform.sensor>
    16-12-30 02:44:23 homeassistant.loader: Loaded switch from homeassistant.components.switch
    16-12-30 02:44:23 homeassistant.loader: Loaded sensor.mysensors from homeassistant.components.sensor.mysensors
    16-12-30 02:44:23 homeassistant.bootstrap: Setting up switch
    16-12-30 02:44:23 homeassistant.components.sensor: Setting up sensor.mysensors
    16-12-30 02:44:24 homeassistant.core: Bus:Handling <Event service_registered[L]: service=turn_off, domain=switch>
    16-12-30 02:44:24 homeassistant.core: Bus:Handling <Event service_registered[L]: service=turn_on, domain=switch>
    16-12-30 02:44:24 homeassistant.core: Bus:Handling <Event service_registered[L]: service=toggle, domain=switch>
    16-12-30 02:44:24 homeassistant.core: Bus:Handling <Event component_loaded[L]: component=switch>
    16-12-30 02:44:24 homeassistant.core: Bus:Handling <Event platform_discovered[L]: discovered=, platform=mysensors, service=load_platform.switch>
    16-12-30 02:44:24 homeassistant.loader: Loaded light from homeassistant.components.light
    16-12-30 02:44:24 homeassistant.loader: Loaded switch.mysensors from homeassistant.components.switch.mysensors
    16-12-30 02:44:24 homeassistant.bootstrap: Setting up light
    16-12-30 02:44:24 homeassistant.components.switch: Setting up switch.mysensors
    16-12-30 02:44:24 homeassistant.core: Bus:Handling <Event service_registered[L]: service=mysensors_send_ir_code, domain=switch>
    16-12-30 02:44:24 homeassistant.core: Bus:Handling <Event service_registered[L]: service=turn_on, domain=light>
    16-12-30 02:44:24 homeassistant.core: Bus:Handling <Event service_registered[L]: service=turn_off, domain=light>
    16-12-30 02:44:24 homeassistant.core: Bus:Handling <Event service_registered[L]: service=toggle, domain=light>
    16-12-30 02:44:24 homeassistant.core: Bus:Handling <Event component_loaded[L]: component=light>
    16-12-30 02:44:24 homeassistant.core: Bus:Handling <Event platform_discovered[L]: discovered=, platform=mysensors, service=load_platform.light>
    16-12-30 02:44:24 homeassistant.loader: Loaded binary_sensor from homeassistant.components.binary_sensor
    16-12-30 02:44:24 homeassistant.loader: Loaded light.mysensors from homeassistant.components.light.mysensors
    16-12-30 02:44:24 homeassistant.bootstrap: Setting up binary_sensor
    16-12-30 02:44:24 homeassistant.core: Bus:Handling <Event component_loaded[L]: component=binary_sensor>
    16-12-30 02:44:24 homeassistant.core: Bus:Handling <Event platform_discovered[L]: discovered=, platform=mysensors, service=load_platform.binary_sensor>
    16-12-30 02:44:24 homeassistant.loader: Loaded climate from homeassistant.components.climate
    16-12-30 02:44:24 homeassistant.components.light: Setting up light.mysensors
    16-12-30 02:44:24 homeassistant.loader: Loaded binary_sensor.mysensors from homeassistant.components.binary_sensor.mysensors
    16-12-30 02:44:24 homeassistant.bootstrap: Setting up climate
    16-12-30 02:44:24 homeassistant.components.binary_sensor: Setting up binary_sensor.mysensors
    16-12-30 02:44:24 homeassistant.core: Bus:Handling <Event service_registered[L]: service=set_away_mode, domain=climate>
    16-12-30 02:44:24 homeassistant.core: Bus:Handling <Event service_registered[L]: service=set_aux_heat, domain=climate>
    16-12-30 02:44:24 homeassistant.core: Bus:Handling <Event service_registered[L]: service=set_temperature, domain=climate>
    16-12-30 02:44:24 homeassistant.core: Bus:Handling <Event service_registered[L]: service=set_humidity, domain=climate>
    16-12-30 02:44:24 homeassistant.core: Bus:Handling <Event service_registered[L]: service=set_fan_mode, domain=climate>
    16-12-30 02:44:24 homeassistant.core: Bus:Handling <Event service_registered[L]: service=set_operation_mode, domain=climate>
    16-12-30 02:44:24 homeassistant.core: Bus:Handling <Event service_registered[L]: service=set_swing_mode, domain=climate>
    16-12-30 02:44:24 homeassistant.core: Bus:Handling <Event component_loaded[L]: component=climate>
    16-12-30 02:44:24 homeassistant.core: Bus:Handling <Event platform_discovered[L]: discovered=, platform=mysensors, service=load_platform.climate>
    16-12-30 02:44:24 homeassistant.loader: Loaded cover from homeassistant.components.cover
    16-12-30 02:44:24 homeassistant.loader: Loaded climate.mysensors from homeassistant.components.climate.mysensors
    16-12-30 02:44:24 homeassistant.bootstrap: Setting up cover
    16-12-30 02:44:24 homeassistant.components.climate: Setting up climate.mysensors
    16-12-30 02:44:24 homeassistant.core: Bus:Handling <Event service_registered[L]: service=set_cover_position, domain=cover>
    16-12-30 02:44:24 homeassistant.core: Bus:Handling <Event service_registered[L]: service=open_cover_tilt, domain=cover>
    16-12-30 02:44:24 homeassistant.core: Bus:Handling <Event service_registered[L]: service=set_cover_tilt_position, domain=cover>
    16-12-30 02:44:24 homeassistant.core: Bus:Handling <Event service_registered[L]: service=open_cover, domain=cover>
    16-12-30 02:44:24 homeassistant.core: Bus:Handling <Event service_registered[L]: service=stop_cover_tilt, domain=cover>
    16-12-30 02:44:24 homeassistant.core: Bus:Handling <Event service_registered[L]: service=stop_cover, domain=cover>
    16-12-30 02:44:24 homeassistant.core: Bus:Handling <Event service_registered[L]: service=close_cover_tilt, domain=cover>
    16-12-30 02:44:24 homeassistant.core: Bus:Handling <Event service_registered[L]: service=close_cover, domain=cover>
    16-12-30 02:44:24 homeassistant.core: Bus:Handling <Event component_loaded[L]: component=cover>
    16-12-30 02:44:24 homeassistant.core: Bus:Handling <Event platform_discovered[L]: discovered=, platform=mysensors, service=load_platform.cover>
    16-12-30 02:44:24 homeassistant.loader: Loaded cover.mysensors from homeassistant.components.cover.mysensors
    16-12-30 02:44:24 homeassistant.components.cover: Setting up cover.mysensors
    16-12-30 02:44:24 homeassistant.core: Starting Home Assistant core loop
    16-12-30 02:44:24 homeassistant.core: Starting Home Assistant
    16-12-30 02:44:24 homeassistant.core: Bus:Handling <Event service_registered[L]: service=stop, domain=homeassistant>
    16-12-30 02:44:24 homeassistant.core: Bus:Handling <Event service_registered[L]: service=restart, domain=homeassistant>
    16-12-30 02:44:24 homeassistant.core: Bus:Handling <Event homeassistant_start[L]>
    16-12-30 02:44:24 mysensors.mysensors: Setting up initial MQTT topic subscription
    16-12-30 02:44:24 homeassistant.core: Timer:starting
    16-12-30 02:44:24 mysensors.mysensors: Subscribing to: mysensors-out/+/+/0/+/+
    16-12-30 02:44:24 homeassistant.components.mysensors: Update persistence: node 5
    16-12-30 02:44:24 mysensors.mysensors: Subscribing to: mysensors-out/+/+/3/+/+
    16-12-30 02:44:24 netdisco.service: Scanning
    16-12-30 02:44:25 homeassistant.components.http: Serving /api/websocket to 192.168.1.1 (auth: False)
    16-12-30 02:44:25 homeassistant.components.http: Serving /api/bootstrap to 192.168.1.1 (auth: True)
    16-12-30 02:44:30 homeassistant.core: Bus:Handling <Event state_changed[L]: entity_id=sun.sun, old_state=<state sun.sun=below_horizon; elevation=0, next_setting=2016-12-30T22:36:51+00:00, azimuth=0, friendly_name=Sun, next_rising=2016-12-30T12:42:08+00:00 @ 2016-12-29T21:44:23.839549-05:00>, new_state=<state sun.sun=below_horizon; elevation=-50.46, next_setting=2016-12-30T22:36:51+00:00, azimuth=274.35, friendly_name=Sun, next_rising=2016-12-30T12:42:08+00:00 @ 2016-12-29T21:44:23.839549-05:00>>
    16-12-30 02:44:45 homeassistant.core: Bus:Handling <Event mqtt_message_received[L]: qos=0, payload=0, topic=mysensors-out/5/255/3/0/6>
    16-12-30 02:44:45 mysensors.mysensors: Receiving 5;255;3;0;6;0
    16-12-30 02:44:45 mysensors.mysensors: Publishing 5;255;3;0;6;I

    16-12-30 02:44:45 homeassistant.core: Bus:Handling <Event call_service[L]: service_call_id=1977841328-1, service_data=qos=0, payload=I, retain=True, topic=mysensors-in/5/255/3/0/6, service=publish, domain=mqtt>
    16-12-30 02:44:45 homeassistant.core: Bus:Handling <Event service_executed[L]: service_call_id=1977841328-1>
    16-12-30 02:44:47 homeassistant.core: Bus:Handling <Event mqtt_message_received[L]: qos=0, payload=IR Rec/Playback, topic=mysensors-out/5/255/3/0/11>
    16-12-30 02:44:47 mysensors.mysensors: Receiving 5;255;3;0;11;IR Rec/Playback
    16-12-30 02:44:47 homeassistant.components.mysensors: Update sensor_update: node 5
    16-12-30 02:44:47 homeassistant.core: Bus:Handling <Event mqtt_message_received[L]: qos=0, payload=2.0, topic=mysensors-out/5/255/3/0/12>
    16-12-30 02:44:47 homeassistant.core: Bus:Handling <Event mqtt_message_received[L]: qos=0, payload=, topic=mysensors-out/5/4/0/0/20>
    16-12-30 02:44:47 mysensors.mysensors: Receiving 5;255;3;0;12;2.0
    16-12-30 02:44:47 mysensors.mysensors: Receiving 5;4;0;0;20;
    16-12-30 02:44:47 homeassistant.components.mysensors: Update sensor_update: node 5
    16-12-30 02:44:47 homeassistant.components.mysensors: Update sensor_update: node 5
    16-12-30 02:44:47 mysensors.mysensors: Subscribing to: mysensors-out/5/4/1/+/+
    16-12-30 02:44:47 mysensors.mysensors: Subscribing to: mysensors-out/5/4/2/+/+
    16-12-30 02:44:47 mysensors.mysensors: Subscribing to: mysensors-out/5/+/4/+/+
    16-12-30 02:44:54 homeassistant.components.http: Serving /api/bootstrap to 192.168.1.1 (auth: True)
    16-12-30 02:44:54 homeassistant.components.http: Serving /api/websocket to 192.168.1.1 (auth: False)
    16-12-30 02:44:56 homeassistant.components.http: Serving /api/bootstrap to 192.168.1.1 (auth: True)
    16-12-30 02:44:57 homeassistant.components.http: Serving /api/websocket to 192.168.1.1 (auth: False)
    16-12-30 02:45:01 homeassistant.components.http: Serving /api/error_log to 192.168.1.1 (auth: True)



  • To my understanding the record function is not available and the IR sensor is not a sensor, it's a service in a switch domain called
    mysensors_send_ir_code.


  • Plugin Developer

    Everything in the log looks good, except you don't send an initial value for the IR sensor or switch.

    Have you read the docs about presenting a mysensors sensor in home assistant?
    https://home-assistant.io/components/mysensors/#presentation

    Also it's best to start with the relevant example sketch in the mysensors docs at homeassistant.io, when trying a new component/platform. Then when you see that the example sketch is working, you modify it to match your desired behavior. The mysensors implementation in home assistant has some requirements that are not always met in the default example sketches in the mysensors library, particularly sending of initial values. That's why we've added the example sketches in the homeassistant docs for mysensors.

    This is the example sketch for the IR sensor/switch. It should create one IR sensor and one IR switch (Edit: NOTE it's written for mysensors 1.5).
    https://home-assistant.io/components/switch.mysensors/#ir-switch-sketch

    The V_IR_RECORD type is not yet available in home assistant. I can add this but I haven't looked into this type yet so much. It seems it should be very similar to V_IR_SEND, ie the controller should be able to send codes as payload using this sub-type.



  • @martinhjelmare said:

    you read the docs about presenting a mysensors sensor in home assista

    If my gateway is v2.0.X will the samples created for 1.5 work?


  • Plugin Developer

    No, not directly. You have to update the sketch to use 2.0 API, according to eg this guide:
    https://forum.mysensors.org/topic/4276/converting-a-sketch-from-1-5-x-to-2-0-x

    Also take note of how initial values have to be sent as mentioned here:
    https://home-assistant.io/components/mysensors/#presentation

    If you update the example for 2.0, please repost it here, and I can update the docs, or even better make a PR directly to the docs at homeassistant.io.


Log in to reply
 

Looks like your connection to MySensors Forum was lost, please wait while we try to reconnect.