HA SwitchPlate HASPone: DIY In-Wall Touchscreen Home Assistant Controller

Many Thanks Luma for the new version, I’m installing it.

1 Like

Hello, i need a small help for setup my cover with slider

i change code:

  # when the user moves the slider, change the light in Hass
  - alias: hasp_chambre1_p4_Dimmer7UpdateHass
    trigger:
      - platform: mqtt
        topic: "hasp/chambre1/state/p[4].b[7].val"
    action:
      - service: cover.set_cover_position
        data_template:
          entity_id: cover.fibaro_volet_principale_level
          position: "{{ trigger.payload }}"

  # When the light is changed in Hass, update HASP to move the dimmer
  - alias: hasp_chambre1_p4_Dimmer7UpdateHASP
    trigger:
      - platform: state
        entity_id: "binary_sensor.chambre1_connected"
        to: "on"
      - platform: homeassistant
        event: start
      - platform: state
        entity_id: cover.fibaro_volet_principale_level
    action:
      - service: mqtt.publish
        data_template:
          topic: "hasp/chambre1/command/p[4].b[7].val"
          payload_template: "{{states.cover.fibaro_volet_principale_level.attributes.current_position|default(0)|int}}"

and is work but slider don’t go over middle because brigtness is 0 to 255 position and cover is 0 to 100

easy way is multiplied by 2.55 i don’t no who make that

thanks for your help :wink:

Hello, i don’t understand your p9_hvac.yaml “temp_high/temp_low”

for me it’s more efficient and easy to setup like this :slight_smile:

for controling air conditioner is perfect

So i tried to adapt P9 plate and is work for 80%

All mode, b9 (+) and b12 (-) work, if i click on them i can change mode or turn off, i can change temp b9 for +1° and b12 for -1°

but i can’t change background color on b5 and on right side nothing on screen

my code

##############################################################################
# Automations for handling climate controls on page 9

automation:
  # Set font and text labels for scene buttons on device connection
  - alias: hasp_chambre1_p9_HVACInit
    trigger:
      - platform: state
        entity_id: "binary_sensor.chambre1_connected"
        to: "on"
      - platform: homeassistant
        event: start
    action:
      - service: mqtt.publish
        data:
          topic: "hasp/chambre1/command/json"
          payload_template: >-
            ["p[9].b[4].font=8","p[9].b[4].txt=\"\"",
            "p[9].b[5].font=8","p[9].b[5].txt=\"\"",
            "p[9].b[6].font=10","p[9].b[6].ycen=2",
            "p[9].b[7].font=8","p[9].b[7].txt=\"\"",
            "p[9].b[8].font=8","p[9].b[8].txt=\"\"",
            "p[9].b[9].font=10","p[9].b[9].bco=63488","p[9].b[9].txt=\"+\"",
            "p[9].b[10].font=8","p[9].b[10].txt=\"\"",
            "p[9].b[11].font=8","p[9].b[11].txt=\"\"",
            "p[9].b[12].font=10","p[9].b[12].bco=31","p[9].b[12].txt=\"-\""]
      - service: mqtt.publish
        data:
          topic: "hasp/chambre1/command/p[9].b[6].txt"
          payload_template: '{{ state_attr("climate.office_ac", "temperature") }}'

  # Catch either of the "mode" buttons, iterate through the list of supported modes, and
  # select the next one in the list or loop back to the beginning if it's the last item
  - alias: hasp_chambre1_p9_HVACModeB4
    trigger:
      - platform: mqtt
        topic: "hasp/chambre1/state/p[9].b[4]"
        payload: "ON"
    action:
      - service: climate.set_hvac_mode
        data:
          entity_id: "climate.office_ac"
          hvac_mode: "off"

  - alias: hasp_chambre1_p9_HVACModeB5
    trigger:
      - platform: mqtt
        topic: "hasp/chambre1/state/p[9].b[5]"
        payload: "ON"
    action:
      - service: climate.set_hvac_mode
        data:
          entity_id: "climate.office_ac"
          hvac_mode: "heat"
          
  - alias: hasp_chambre1_p9_HVACModeB7
    trigger:
      - platform: mqtt
        topic: "hasp/chambre1/state/p[9].b[7]"
        payload: "ON"
    action:
      - service: climate.set_hvac_mode
        data:
          entity_id: "climate.office_ac"
          hvac_mode: "cool"
          
  - alias: hasp_chambre1_p9_HVACModeB8
    trigger:
      - platform: mqtt
        topic: "hasp/chambre1/state/p[9].b[8]"
        payload: "ON"
    action:
      - service: climate.set_hvac_mode
        data:
          entity_id: "climate.office_ac"
          hvac_mode: "dry"
          
  - alias: hasp_chambre1_p9_HVACModeB10
    trigger:
      - platform: mqtt
        topic: "hasp/chambre1/state/p[9].b[10]"
        payload: "ON"
    action:
      - service: climate.set_hvac_mode
        data:
          entity_id: "climate.office_ac"
          hvac_mode: "fan_only"
          
  - alias: hasp_chambre1_p9_HVACModeB11
    trigger:
      - platform: mqtt
        topic: "hasp/chambre1/state/p[9].b[11]"
        payload: "ON"
    action:
      - service: climate.set_hvac_mode
        data:
          entity_id: "climate.office_ac"
          hvac_mode: "heat_cool"
  
  # Display current HVAC temp on HASP when updated in Home Assistant
  - alias: hasp_chambre1_p9_UpdateHVACTemp
    trigger:
      platform: state
      entity_id: "climate.office_ac"
    condition:
      condition: template
      value_template: '{{ trigger.from_state and trigger.to_state.attributes.temperature != trigger.from_state.attributes.temperature }}'
    action:
      - service: mqtt.publish
        data:
          topic: "hasp/chambre1/command/p[9].b[6].txt"
          payload_template: '{{ state_attr("climate.office_ac", "temperature") }}°'

  # Increment HVAC high temp set point when p[9].b[9] is pressed
  - alias: hasp_chambre1_p9_SetHVACTempPlus
    trigger:
      - platform: mqtt
        topic: "hasp/chambre1/state/p[9].b[9]"
        payload: "ON"
    action:
      - service: climate.set_temperature
        entity_id: "climate.office_ac"
        data_template:
          temperature: '{{ state_attr("climate.office_ac", "temperature") + 1 | int}}'

  # Decrement HVAC high temp set point when p[9].b[12] is pressed
  - alias: hasp_chambre1_p9_SetHVACTempMinus
    trigger:
      - platform: mqtt
        topic: "hasp/chambre1/state/p[9].b[12]"
        payload: "ON"
    action:
      - service: climate.set_temperature
        entity_id: "climate.office_ac"
        data_template:
          temperature: '{{ state_attr("climate.office_ac", "temperature") - 1 | int}}'

##############################################################################
# Automations to set colors on HASP Page 9
#
  - alias: hasp_chambre1_p9_ColorConfig_selectedbackgroundcolor
    trigger:
      - platform: state
        entity_id: "binary_sensor.chambre1_connected"
        to: "on"
      - platform: homeassistant
        event: start
      - platform: state
        entity_id: input_number.hasp_chambre1_selectedbackgroundcolor
    action:
      - service: mqtt.publish
        data:
          topic: "hasp/chambre1/command/json"
          payload_template: >-
            ["p[9].b[4].pco={{ states('input_number.hasp_chambre1_selectedbackgroundcolor')|int }}",
            "p[9].b[5].bco={{ states('input_number.hasp_chambre1_selectedbackgroundcolor')|int }}",
            "p[9].b[6].bco={{ states('input_number.hasp_chambre1_selectedbackgroundcolor')|int }}",
            "p[9].b[7].pco={{ states('input_number.hasp_chambre1_selectedbackgroundcolor')|int }}",
            "p[9].b[8].pco={{ states('input_number.hasp_chambre1_selectedbackgroundcolor')|int }}",
            "p[9].b[9].bco={{ states('input_number.hasp_chambre1_selectedbackgroundcolor')|int }}",
            "p[9].b[10].pco={{ states('input_number.hasp_chambre1_selectedbackgroundcolor')|int }}",
            "p[9].b[11].pco={{ states('input_number.hasp_chambre1_selectedbackgroundcolor')|int }}",
            "p[9].b[12].bco={{ states('input_number.hasp_chambre1_selectedbackgroundcolor')|int }}"]
  - alias: hasp_chambre1_p9_ColorConfig_unselectedforegroundcolor
    trigger:
      - platform: state
        entity_id: "binary_sensor.chambre1_connected"
        to: "on"
      - platform: homeassistant
        event: start
      - platform: state
        entity_id: input_number.hasp_chambre1_unselectedforegroundcolor
    action:
      - service: mqtt.publish
        data:
          topic: "hasp/chambre1/command/json"
          payload_template: >-
            [{%- for i in range(4,13) -%}"p[9].b[{{i}}].pco2={{ states('input_number.hasp_chambre1_unselectedforegroundcolor')|int }}"{% if not loop.last %},{% endif %}{%- endfor -%}]
  - alias: hasp_chambre1_p9_ColorConfig_unselectedbackgroundcolor
    trigger:
      - platform: state
        entity_id: "binary_sensor.chambre1_connected"
        to: "on"
      - platform: homeassistant
        event: start
      - platform: state
        entity_id: input_number.hasp_chambre1_unselectedbackgroundcolor
    action:
      - service: mqtt.publish
        data:
          topic: "hasp/chambre1/command/json"
          payload_template: >-
            [{%- for i in range(4,13) -%}"p[9].b[{{i}}].bco2={{ states('input_number.hasp_chambre1_unselectedbackgroundcolor')|int }}"{% if not loop.last %},{% endif %}{%- endfor -%}]

if you can help me thank you :wink:

Not sure if this is your problem, but at the bottom of your P9 automations you just posted I’m not seeing the hasp_plate01_p9_ColorConfig_selectedforegroundcolor automation. Did you remove that on purpose?

hello, i see, i remove a part of code for tests and forget :frowning:
i fix it now :

my last problem is b5 to have a white background (like other)

thanks for your help :slight_smile:

##############################################################################
# Automations for handling climate controls on page 9

automation:
  # Set font and text labels for scene buttons on device connection
  - alias: hasp_chambre1_p9_HVACInit
    trigger:
      - platform: state
        entity_id: "binary_sensor.chambre1_connected"
        to: "on"
      - platform: homeassistant
        event: start
    action:
      - service: mqtt.publish
        data:
          topic: "hasp/chambre1/command/json"
          payload_template: >-
            ["p[9].b[4].font=8","p[9].b[4].txt=\"\"",
            "p[9].b[5].font=8","p[9].b[5].txt=\"\"",
            "p[9].b[6].font=10","p[9].b[6].ycen=2",
            "p[9].b[7].font=8","p[9].b[7].txt=\"\"",
            "p[9].b[8].font=8","p[9].b[8].txt=\"\"",
            "p[9].b[9].font=10","p[9].b[9].bco=63488","p[9].b[9].txt=\"\"",
            "p[9].b[10].font=8","p[9].b[10].txt=\"\"",
            "p[9].b[11].font=8","p[9].b[11].txt=\"\"",
            "p[9].b[12].font=10","p[9].b[12].bco=31","p[9].b[12].txt=\"\""]
      - service: mqtt.publish
        data:
          topic: "hasp/chambre1/command/p[9].b[6].txt"
          payload_template: '"  {{ state_attr("climate.office_ac", "temperature") }}°"'

  # Display current HVAC temp on HASP when updated in Home Assistant
  - alias: hasp_chambre1_p9_UpdateHVACTemp
    trigger:
      platform: state
      entity_id: "climate.office_ac"
    condition:
      condition: template
      value_template: '{{ trigger.from_state and trigger.to_state.attributes.temperature != trigger.from_state.attributes.temperature }}'
    action:
      - service: mqtt.publish
        data:
          topic: "hasp/chambre1/command/p[9].b[6].txt"
          payload_template: '"  {{ state_attr("climate.office_ac", "temperature") }}°"'


  # Catch either of the "mode" buttons, iterate through the list of supported modes, and
  # select the next one in the list or loop back to the beginning if it's the last item
  - alias: hasp_chambre1_p9_HVACModeB4
    trigger:
      - platform: mqtt
        topic: "hasp/chambre1/state/p[9].b[4]"
        payload: "ON"
    action:
      - service: climate.set_hvac_mode
        data:
          entity_id: "climate.office_ac"
          hvac_mode: "off"

  - alias: hasp_chambre1_p9_HVACModeB5
    trigger:
      - platform: mqtt
        topic: "hasp/chambre1/state/p[9].b[5]"
        payload: "ON"
    action:
      - service: climate.set_hvac_mode
        data:
          entity_id: "climate.office_ac"
          hvac_mode: "heat"
          
  - alias: hasp_chambre1_p9_HVACModeB7
    trigger:
      - platform: mqtt
        topic: "hasp/chambre1/state/p[9].b[7]"
        payload: "ON"
    action:
      - service: climate.set_hvac_mode
        data:
          entity_id: "climate.office_ac"
          hvac_mode: "cool"
          
  - alias: hasp_chambre1_p9_HVACModeB8
    trigger:
      - platform: mqtt
        topic: "hasp/chambre1/state/p[9].b[8]"
        payload: "ON"
    action:
      - service: climate.set_hvac_mode
        data:
          entity_id: "climate.office_ac"
          hvac_mode: "dry"
          
  - alias: hasp_chambre1_p9_HVACModeB10
    trigger:
      - platform: mqtt
        topic: "hasp/chambre1/state/p[9].b[10]"
        payload: "ON"
    action:
      - service: climate.set_hvac_mode
        data:
          entity_id: "climate.office_ac"
          hvac_mode: "fan_only"
          
  - alias: hasp_chambre1_p9_HVACModeB11
    trigger:
      - platform: mqtt
        topic: "hasp/chambre1/state/p[9].b[11]"
        payload: "ON"
    action:
      - service: climate.set_hvac_mode
        data:
          entity_id: "climate.office_ac"
          hvac_mode: "heat_cool"

  # Increment HVAC high temp set point when p[9].b[9] is pressed
  - alias: hasp_chambre1_p9_SetHVACTempPlus
    trigger:
      - platform: mqtt
        topic: "hasp/chambre1/state/p[9].b[9]"
        payload: "ON"
    action:
      - service: climate.set_temperature
        entity_id: "climate.office_ac"
        data_template:
          temperature: '{{ state_attr("climate.office_ac", "temperature") + 1 | int}}'

  # Decrement HVAC high temp set point when p[9].b[12] is pressed
  - alias: hasp_chambre1_p9_SetHVACTempMinus
    trigger:
      - platform: mqtt
        topic: "hasp/chambre1/state/p[9].b[12]"
        payload: "ON"
    action:
      - service: climate.set_temperature
        entity_id: "climate.office_ac"
        data_template:
          temperature: '{{ state_attr("climate.office_ac", "temperature") - 1 | int}}'

##############################################################################
# Automations to set colors on HASP Page 9
#
  - alias: hasp_chambre1_p9_ColorConfig_selectedforegroundcolor
    trigger:
      - platform: state
        entity_id: "binary_sensor.chambre1_connected"
        to: "on"
      - platform: homeassistant
        event: start
      - platform: state
        entity_id: input_number.hasp_chambre1_selectedforegroundcolor
    action:
      - service: mqtt.publish
        data:
          topic: "hasp/chambre1/command/json"
          payload_template: >-
            ["p[9].b[4].bco={{ states('input_number.hasp_chambre1_selectedforegroundcolor')|int }}",
            "p[9].b[5].pco={{ states('input_number.hasp_chambre1_selectedforegroundcolor')|int }}",
            "p[9].b[6].pco={{ states('input_number.hasp_chambre1_selectedforegroundcolor')|int }}"]
  - alias: hasp_chambre1_p9_ColorConfig_selectedbackgroundcolor
    trigger:
      - platform: state
        entity_id: "binary_sensor.chambre1_connected"
        to: "on"
      - platform: homeassistant
        event: start
      - platform: state
        entity_id: input_number.hasp_chambre1_selectedbackgroundcolor
    action:
      - service: mqtt.publish
        data:
          topic: "hasp/chambre1/command/json"
          payload_template: >-
            ["p[9].b[4].pco={{ states('input_number.hasp_chambre1_selectedbackgroundcolor')|int }}",
            "p[9].b[5].bco={{ states('input_number.hasp_chambre1_selectedbackgroundcolor')|int }}",
            "p[9].b[6].bco={{ states('input_number.hasp_chambre1_selectedbackgroundcolor')|int }}",
            "p[9].b[7].pco={{ states('input_number.hasp_chambre1_selectedbackgroundcolor')|int }}",
            "p[9].b[8].pco={{ states('input_number.hasp_chambre1_selectedbackgroundcolor')|int }}",
            "p[9].b[9].bco={{ states('input_number.hasp_chambre1_selectedbackgroundcolor')|int }}",
            "p[9].b[10].pco={{ states('input_number.hasp_chambre1_selectedbackgroundcolor')|int }}",
            "p[9].b[11].pco={{ states('input_number.hasp_chambre1_selectedbackgroundcolor')|int }}",
            "p[9].b[12].bco={{ states('input_number.hasp_chambre1_selectedbackgroundcolor')|int }}"]
  - alias: hasp_chambre1_p9_ColorConfig_unselectedforegroundcolor
    trigger:
      - platform: state
        entity_id: "binary_sensor.chambre1_connected"
        to: "on"
      - platform: homeassistant
        event: start
      - platform: state
        entity_id: input_number.hasp_chambre1_unselectedforegroundcolor
    action:
      - service: mqtt.publish
        data:
          topic: "hasp/chambre1/command/json"
          payload_template: >-
            [{%- for i in range(4,13) -%}"p[9].b[{{i}}].pco2={{ states('input_number.hasp_chambre1_unselectedforegroundcolor')|int }}"{% if not loop.last %},{% endif %}{%- endfor -%}]
  - alias: hasp_chambre1_p9_ColorConfig_unselectedbackgroundcolor
    trigger:
      - platform: state
        entity_id: "binary_sensor.chambre1_connected"
        to: "on"
      - platform: homeassistant
        event: start
      - platform: state
        entity_id: input_number.hasp_chambre1_unselectedbackgroundcolor
    action:
      - service: mqtt.publish
        data:
          topic: "hasp/chambre1/command/json"
          payload_template: >-
            [{%- for i in range(4,13) -%}"p[9].b[{{i}}].bco2={{ states('input_number.hasp_chambre1_unselectedbackgroundcolor')|int }}"{% if not loop.last %},{% endif %}{%- endfor -%}]

Can you tell me what display you are using? Thank you

if the question is for me, a nextion 3.5" if you want .tft file send me a PM :wink:

IMG_20200520_075044 IMG_20200520_075038 IMG_20200520_075016

Voila, i find solution for background, now i need only translate state of weather for this plate

thanks for your project is amazing

1 Like

Please TFT file, I will be grateful thank you Michal

here you have

for 3.5" :wink:

Hello, for my cover i can’t make working

  # when the user moves the slider, change the light in Hass
  - alias: hasp_chambre1_p4_Dimmer7UpdateHass
    trigger:
      - platform: mqtt
        topic: "hasp/chambre1/state/p[4].b[8].val"
    action:
      - service: cover.set_cover_position
        data_template:
          entity_id: cover.fibaro_volet_principale_level
          position: "{{ (trigger.payload|int) }}"

  # When the light is changed in Hass, update HASP to move the dimmer
  - alias: hasp_chambre1_p4_Dimmer7UpdateHASP
    trigger:
      - platform: state
        entity_id: "binary_sensor.chambre1_connected"
        to: "on"
      - platform: homeassistant
        event: start
      - platform: state
        entity_id: cover.fibaro_volet_principale_level
    action:
      - service: mqtt.publish
        data_template:
          topic: "hasp/chambre1/command/p[4].b[8].val"
          payload_template: "{{states.cover.fibaro_volet_principale_level.attributes.current_position|default(0)|int * 2.55 | round(0) }}"

Silder showing good position now (with |int * 2.55 | round(0)), but problem is moving slider on screen only on first 1/3 of slider works, (0 to 100 is ok, 101 to 255 not working)

i tried a lot of code but nothing work / 2.55 | round(0) or / 2.55

"{{ (trigger.payload|int) / 2.55 | round(0) }}"

thanks for your help :wink:

Hi, I am new here so sorry If this question is already asked. I am looking for a solution that fits in a bticino living light frame. A 2.8 inch Nextion panel that can be nicely integrated in such a frame. A 3d model that can be printed would be great. Thank you.

Hello,
I’m new here as well and can’t code yaml but i want to try to make a display for my alarm clock.
Is it possible to use this project for it?
Or is it nessesary to re-write Aurdino_sketch as well?

Like I said I can’t write yaml so I will try to do automation part in Node-red.

I have seen other projects as well they use ESPhome for it. i guess thats replace the mqtt part.
But thats more code to write i think.

I see al lot of automations in HA but where are they stored? Can i see/change them?

Sorry for the absolute beginners questions

The default project includes a set of automations that looks like this, so maybe you can make this work like you’d want?


You can get pretty advanced with this project without ever touching the Arduino code. You will however need to be able to get Home Assistant to send MQTT messages back and forth and to Do Things in response. This project uses Home Assistant automations in a set of YAML files to do that. One could do the same thing in Node-Red, but you’d be re-inventing a lot of wheels and it would require being able to understand the existing YAML files in order to figure out what they’re doing. So… either way, you’re going to need to be able to deal with YAML files at some point.

You can browse most of the automations used by the project here in this folder. This here is the clock bit.

1 Like

The other day, I did a stupid thing. While working on another project, I accidentally uploaded that file to my HASP. Well, since I had to reflash it now, I upgraded to 0.40 and LCD 2 to see all the new changes. Looking really great. After getting all the problems created by the hass developers worked out, I started playing with the new features. The one in particular I wanted was the fan control. I was able to work out the basic changes to get it to control my fan, but there are still a couple glitches I need to work out.

First, when I press the OFF button, the fan turns off, but the last speed that was selected stays highlighted.

Second, when the unit starts up, it doesn’t set the controls to the current status of the fan (light and speed).

I am using a Sonoff iFan03 controller with the latest version of Tasmota. It looks like there are some differences between what is in the automation and what this version of the controller firmware does. It seems the controller is not updating HA as the state shows the speed as off, but it is running on medium. Any suggestions on where to look or what to do?

Trying to get my Honeywell Home RTH9585WF1004 thermostat to work with HASP. Partial success. I can display the temperature (climate.current_temperature) and target temperature (climate.temperature). I can’t get it to set the target temperature. I can set it with the thermostat card, so I know it can be done, but not sure how. I don’t see anything in my MQTT Explorer when I change the target temperature with the card so I don’t think it is talking through the MQTT server.

Does anyone have any suggestions of a good thermostat that would work with this, other than Nest? Don’t want one that has to have an outside network connection to work.

Thanks for explaining @luma
I will start working on it tomorrow.
Very nice project!

UPDATE: Got it working. Because this thermostat doesn’t support the min/max setting, I changed how the interface works. There is only one temperature setting field and it changes based on the hvac mode. I can also get the inside humidity and I display that in the lower field.

2 Likes

Ran into an issue with 0.40 when changing pages. When I issue the command to change pages, the icons on the page are not shown. Text shows up, but not the icons. The icons will eventually show when the field is updated.

EDIT: This occurs when going back to the status page.