nick2525 / broadlink_s1c_s2c

Broadlink s2c and Broadlink s1c sensors for Home Assistant
MIT License
10 stars 8 forks source link

Change state names #4

Closed rucanunes closed 2 years ago

rucanunes commented 3 years ago

Does anyone knows where I can change these text?

s1c

rucanunes commented 3 years ago

No one?

PcOnline2004 commented 3 years ago

You could make the template binary_sensor for them. Change the classes with your wish.

rucanunes commented 3 years ago

Could you please tell me how to do that?

rucanunes commented 3 years ago

I know where the file where "No_motion" and "motion_detected" are and I can change that, I just can't find the "open" and "closed" text....

PcOnline2004 commented 3 years ago

Following this: https://www.home-assistant.io/integrations/template/

rucanunes commented 3 years ago

I have already changed the "no_motion" and "motion_detected" in the "cover.yaml file. I just can't find the "open" and "closed"...

PcOnline2004 commented 3 years ago

Here is my Broadlink binary_sensor (template) file. ####### Broadlink Sensors converted

Window Sensors

  broadlink_s1c_bedroom_win_r:  
    friendly_name: "Broadlink TC Bedroom Win R"
    device_class: window
    icon_template: >-
      {% if is_state('sensor.broadlink_s1c_bedroom_win_r', 'open') %}
        mdi:window-open
      {% else %}
        mdi:window-closed
      {% endif %}
    value_template: >-
      {% if is_state('sensor.broadlink_s1c_bedroom_win_r', 'open') %}
        on
        {% else %} 
        off
        {% endif%}             
  broadlink_s1c_bedroom_win_l:  
    friendly_name: "Broadlink TC Bedroom Win L"
    device_class: window
    icon_template: >-
      {% if is_state('sensor.broadlink_s1c_bedroom_win_l', 'open') %}
        mdi:window-open
      {% else %}
        mdi:window-closed
      {% endif %}
    value_template: >-
      {% if is_state('sensor.broadlink_s1c_bedroom_win_l', 'open') %}
        on
        {% else %} 
        off
        {% endif%}
  broadlink_s1c_downstair_win:  
    friendly_name: "Broadlink Downstair Window"
    device_class: window
    icon_template: >-
      {% if is_state('sensor.broadlink_s1c_downstair_win', 'open') %}
        mdi:window-open
      {% else %}
        mdi:window-closed
      {% endif %}
    value_template: >-
      {% if is_state('sensor.broadlink_s1c_downstair_win', 'open') %}
        on
        {% else %} 
        off
        {% endif%}
  broadlink_s1c_upstair_win:  
    friendly_name: "Broadlink Upstair Window"
    device_class: window
    icon_template: >-
      {% if is_state('sensor.broadlink_s1c_upstair_win', 'open') %}
        mdi:window-open
      {% else %}
        mdi:window-closed
      {% endif %}
    value_template: >-
      {% if is_state('sensor.broadlink_s1c_upstair_win', 'open') %}
        on
        {% else %} 
        off
        {% endif%}            
  broadlink_s1c_cathy_win:  
    friendly_name: "Broadlink Cathy Window"
    device_class: window
    icon_template: >-
      {% if is_state('sensor.broadlink_s1c_cathy_win', 'open') %}
        mdi:window-open
      {% else %}
        mdi:window-closed
      {% endif %}
    value_template: >-
      {% if is_state('sensor.broadlink_s1c_cathy_win', 'open') %}
        on
        {% else %} 
        off
        {% endif%}            
Motion Sensors
  broadlink_s1c_livingroom_pir:  
    friendly_name: "Broadlink PIR LVR"
    device_class: motion
    icon_template: >-
      {% if is_state('sensor.broadlink_s1c_livingroom_pir', 'motion_detected') %}
        mdi:run
      {% else %}
        mdi:walk
      {% endif %}
    value_template: >-
      {% if is_state('sensor.broadlink_s1c_livingroom_pir', 'motion_detected') %}
        on
        {% else %} 
        off
        {% endif%}       
  broadlink_s1c_tc_room_pir:  
    friendly_name: "Broadlink PIR TC Bedroom"
    device_class: motion
    icon_template: >-
      {% if is_state('sensor.broadlink_s1c_tc_room_pir', 'motion_detected') %}
        mdi:run
      {% else %}
        mdi:walk
      {% endif %}
    value_template: >-
      {% if is_state('sensor.broadlink_s1c_tc_room_pir', 'motion_detected') %}
        on
        {% else %} 
        off
        {% endif%}                
  broadlink_s1c_cathy_room_pir:  
    friendly_name: "Broadlink PIR Cathy Bedroom"
    device_class: motion
    icon_template: >-
      {% if is_state('sensor.broadlink_s1c_cathy_room_pir', 'motion_detected') %}
        mdi:run
      {% else %}
        mdi:walk
      {% endif %}
    value_template: >-
      {% if is_state('sensor.broadlink_s1c_cathy_room_pir', 'motion_detected') %}
        on
        {% else %} 
        off
        {% endif%}            
  broadlink_s1c_mc_room_pir:  
    friendly_name: "Broadlink PIR MC Room"
    device_class: motion
    icon_template: >-
      {% if is_state('sensor.broadlink_s1c_mc_room_pir', 'motion_detected') %}
        mdi:run
      {% else %}
        mdi:walk
      {% endif %}
    value_template: >-
      {% if is_state('sensor.broadlink_s1c_mc_room_pir', 'motion_detected') %}
        on
        {% else %} 
        off
        {% endif%}            

  broadlink_s1c_upstair_pir:  
    friendly_name: "Broadlink PIR Upstair"
    device_class: motion
    icon_template: >-
      {% if is_state('sensor.broadlink_s1c_upstair_pir', 'motion_detected') %}
        mdi:run
      {% else %}
        mdi:walk
      {% endif %}
    value_template: >-
      {% if is_state('sensor.broadlink_s1c_upstair_pir', 'motion_detected') %}
        on
        {% else %} 
        off
        {% endif%}   
rucanunes commented 3 years ago

Thank you for your help!! All this goes to sensor.yaml?

PcOnline2004 commented 3 years ago

Thank you for your help!! All this goes to sensor.yaml?

No, it is binary_sensor.yaml file

nick2525 commented 2 years ago

Unfortunately, home assistant have only such constants https://github.com/home-assistant/core/blob/dev/homeassistant/const.py

STATES

STATE_ON: Final = "on" STATE_OFF: Final = "off" STATE_HOME: Final = "home" STATE_NOT_HOME: Final = "not_home" STATE_UNKNOWN: Final = "unknown" STATE_OPEN: Final = "open" STATE_OPENING: Final = "opening" STATE_CLOSED: Final = "closed" STATE_CLOSING: Final = "closing" STATE_PLAYING: Final = "playing" STATE_PAUSED: Final = "paused" STATE_IDLE: Final = "idle" STATE_STANDBY: Final = "standby" STATE_ALARM_DISARMED: Final = "disarmed" STATE_ALARM_ARMED_HOME: Final = "armed_home" STATE_ALARM_ARMED_AWAY: Final = "armed_away" STATE_ALARM_ARMED_NIGHT: Final = "armed_night" STATE_ALARM_ARMED_VACATION: Final = "armed_vacation" STATE_ALARM_ARMED_CUSTOM_BYPASS: Final = "armed_custom_bypass" STATE_ALARM_PENDING: Final = "pending" STATE_ALARM_ARMING: Final = "arming" STATE_ALARM_DISARMING: Final = "disarming" STATE_ALARM_TRIGGERED: Final = "triggered" STATE_LOCKED: Final = "locked" STATE_UNLOCKED: Final = "unlocked" STATE_LOCKING: Final = "locking" STATE_UNLOCKING: Final = "unlocking" STATE_JAMMED: Final = "jammed" STATE_UNAVAILABLE: Final = "unavailable" STATE_OK: Final = "ok" STATE_PROBLEM: Final = "problem"

so, there are no constants for STATE_NO_MOTION = "no_motion" STATE_MOTION_DETECTED = "motion_detected" STATE_TAMPERED = "tampered" STATE_ALARM_SOS = "sos"

and this component introduces its constants, but unfortunately, they need to be localized by the user himself. In the future, I will try to make the pull request in Home Assistant to add new constants there. But the likelihood that they will be accepted is minimal. In addition, many users have already used the constants in form in which they are now and I do not want to break compatibility to them. Thank you for the great template solution!