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

I have tried \r but as I said above it does not work. I only put the \r in brackets to show you, when I tried \r it was not in brackets. \r just seems to be ignored. Thanks

Luma actually said try “\\r”. … double back slash r.
Many programming languages do this … this tells the compiler the configuration text includes a single backslash …

Thus the configuration would see \r which is what you want …
Give that a try :sunglasses:

1 Like

My appologies Luma, a case of word blindness, I only saw \r not \r. Sorry.

Wag5659, thanks for making it clear. Yes it works wil \r.

Thank you both

1 Like

For every local interaction, an MQTT message is sent out from the HASP on hasp/<devicename>/state/json. I make use of this in the Activate Page on Idle blueprint which might be of some help.

You can also enable sendxy mode which will send you back the x-y coordinates of every touch interaction as a JSON message.:

mosquitto_pub -h mqtt -t 'hasp/plate01/command/sendxy' -m '1'

Then any screen press results in:

{"event_type":"button_short_press","event":"touchxy","touch_event":"ON","touchx":"157","touchy":"52","screen_state":"awake"}

Would HASPOne work ok on a 3.5in screen, or do I need to modify the page layouts to fit. If this is the case, is it necessary to update the LCD, cannot the old firmware with the customized page layout still be used?

There have been several minor changes to the LCD HMI project in version 3 (current release). If you’re using a different size panel, you’ll probably have to go and re-work the project from the v3 HMI file available on github.

Wish there was a better way to do this, but Nextion is fundamentally a bitmapped solution.

Made my first HASP yesterday, I live in Scotland so I made a desk based option.

I used an old mobile phone stand as I don’t have a 3d printer.


6 Likes

Excellent adaptation. Turned out perfect.
Congratulations…

1 Like

I have a Honeywell Evohome thermostat using separate bridge to connect to the internet and trying to integrate this with HASP, i am on the HASPone firmware, is this similar to your setup as im looking to get this set up.

There is support for this thermostat in HA that I use to access it. It connects via a cloud that Honeywell has.

Thanks, ive got it connected in HA but trying to set it up on page nine of HASP, but not sure how to go about it.
Do i need to setup each segment/button to call a separate service?

Here is the automation I used for mine. climate.thermostat is the entity(?) that I used to access the thermostat. Something has broke with setting colors and icons, but it still controls the thermostat. Need to convert this to work with the blueprints though.

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

automation:
  # Set font and text labels for scene buttons on device connection
  - alias: hasp_devplate_p3_HVACInit
    trigger:
      - platform: state
        entity_id: "binary_sensor.devplate_connected"
        to: "on"
      - platform: homeassistant
        event: start
    action:
      - service: mqtt.publish
        data:
          topic: "hasp/devplate/command/json"
          payload_template: >-
            ["p[9].b[4].font=6","p[9].b[4].txt=\"Mode\"",
            "p[9].b[5].font=6",
            "p[9].b[6].font=10","p[9].b[6].ycen=2",
            "p[9].b[9].font=10","p[9].b[9].ycen=2",
            "p[9].b[10].font=7","p[9].b[10].txt=\"\"",
            "p[9].b[11].font=6","p[9].b[11].txt=\"rH\"",
            "p[9].b[12].font=10","p[9].b[12].ycen=2"]

#            "p[9].b[7].font=7","p[9].b[7].bco=63488","p[9].b[7].txt=\"\"",
#            "p[9].b[8].font=7","p[9].b[8].bco=31","p[9].b[8].txt=\"\"",
#            "p[9].b[9].font=10","p[9].b[9].pco=63488","p[9].b[9].ycen=2",
#            "p[9].b[10].font=7","p[9].b[10].bco=63488","p[9].b[10].txt=\"\"",
#            "p[9].b[11].font=7","p[9].b[11].bco=31","p[9].b[11].txt=\"\"",
#            "p[9].b[12].font=10","p[9].b[12].pco=31","p[9].b[12].ycen=2"]

      - service: mqtt.publish
        data:
          topic: "hasp/devplate/command/p[9].b[5].txt"
          payload_template: '"{{ states("climate.thermostat")|replace("fan_only","Fan")|replace("_"," ")|title }}"'
      - service: mqtt.publish
        data:
          topic: "hasp/devplate/command/p[9].b[6].txt"
          payload_template: '"  {{ state_attr("climate.thermostat", "current_temperature") }}°"'
      - service: mqtt.publish
        data:
          topic: "hasp/devplate/command/json"
# need to determine if we are off/heat/cool and set the color/icon/text accordingly
          payload_template: >-
            [
            {% if is_state('climate.thermostat', 'cool') %}
              "p[9].b[7].bco=31",
              "p[9].b[8].bco=31",
              "p[9].b[9].pco=31",
              "p[9].b[9].txt=\" {{ state_attr("climate.thermostat", "temperature") }}°\""
            {% elif is_state('climate.thermostat', 'heat') %}
              "p[9].b[7].bco=63488",
              "p[9].b[8].bco=63488",
              "p[9].b[9].pco=63488",
              "p[9].b[9].txt=\" {{ state_attr("climate.thermostat", "temperature") }}°\""
            {% else %}
              "p[9].b[7].bco=65535",
              "p[9].b[8].bco=65535",
              "p[9].b[9].pco=65535",
              "p[9].b[9].txt=\"\""
            {% endif %}
            ]              
              
              
#            {% elseif is_state('climate.thermostat', 'heat')% }
#              ["p[9].b[9].pco=63488","p[9].b[9].txt=\" {{ state_attr("climate.thermostat", "temperature") }}°\""]
#            {% else %}
#              ["p[9].b[9].txt=\"\""]
#            {% endif %}
             
#            {% if {{ states("climate.thermostat") == "cool" %}
#                ["p[9].b[9].pco=31","p[9].b[9].txt=\" {{ state_attr("climate.thermostat", "temperature") }}°\""]
#            {% elseif {{ states("climate.thermostat") == "heat" %}
#                ["p[9].b[9].pco=63488","p[9].b[9].txt=\" {{ state_attr("climate.thermostat", "temperature") }}°\""]
#            {% else %}
#                ["p[9].b[9].text =\"\"]
#            {% endif %}
            

#     - service: mqtt.publish
#        data:
#          topic: "hasp/devplate/command/p[9].b[9].txt"
#          payload_template: '" {{ state_attr("climate.thermostat", "temperature") }}°"'

      - service: mqtt.publish
        data:
          topic: "hasp/devplate/command/p[9].b[12].txt"
          payload_template: '"{{ state_attr("climate.thermostat", "current_humidity") }}%"'
#          payload_template: '" {{ state_attr("climate.thermostat", "current_humidity") }}°"'

  - alias: hasp_devplate_p3_UpdateHVACMode
    trigger:
      - platform: state
        entity_id: "climate.thermostat"
    action:
      - service: mqtt.publish
        data:
          topic: "hasp/devplate/command/p[9].b[5].txt"
          payload_template: '"{{ states("climate.thermostat")|replace("fan_only","Fan")|replace("_"," ")|title }}"'

  # 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_devplate_p3_CycleHVACMode
    trigger:
      - platform: mqtt
        topic: "hasp/devplate/state/p[9].b[4]"
        payload: "ON"
      - platform: mqtt
        topic: "hasp/devplate/state/p[9].b[5]"
        payload: "ON"
    action:
      - service: climate.set_hvac_mode
        entity_id: "climate.thermostat"
        data_template:
          hvac_mode: >-
            {% for mode in state_attr("climate.thermostat", "hvac_modes") %}
              {% if mode == states("climate.thermostat") %}
                {% if loop.last %}
                  {{ state_attr("climate.thermostat", "hvac_modes")[0] }}
                {% else %}
                  {{ state_attr("climate.thermostat", "hvac_modes")[loop.index] }}
                {% endif %}
              {% endif %}
            {% endfor %}
  
  # Display current HVAC temp on HASP when updated in Home Assistant
  - alias: hasp_devplate_p3_UpdateHVACTemp
    trigger:
      platform: state
      entity_id: "climate.thermostat"
    condition:
      condition: template
      value_template: '{{ trigger.from_state and trigger.to_state.attributes.current_temperature != trigger.from_state.attributes.current_temperature }}'
    action:
      - service: mqtt.publish
        data:
          topic: "hasp/devplate/command/p[9].b[6].txt"
          payload_template: '"  {{ state_attr("climate.thermostat", "current_temperature") }}°"'
      - service: mqtt.publish
        data:
          topic: "hasp/devplate/command/p[9].b[12].txt"
          payload_template: '"{{ state_attr("climate.thermostat", "current_humidity") }}%"'
          
#          payload_template: '" {{ state_attr("climate.thermostat", "current_humidity") }}°"'

  # Display current HVAC high temp set point on HASP when updated in Home Assistant
  - alias: hasp_devplate_p3_UpdateHVACTempHigh
    trigger:
      platform: state
      entity_id: "climate.thermostat"
    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/devplate/command/json"
          payload_template: >-
            [
            {% if is_state('climate.thermostat', 'cool') %}
              "p[9].b[7].bco=31",
              "p[9].b[8].bco=31",
              "p[9].b[9].pco=31",
              "p[9].b[9].txt=\" {{ state_attr("climate.thermostat", "temperature") }}°\""
            {% elif is_state('climate.thermostat', 'heat') %}
              "p[9].b[7].bco=63488",
              "p[9].b[8].bco=63488",
              "p[9].b[9].pco=63488",
              "p[9].b[9].txt=\" {{ state_attr("climate.thermostat", "temperature") }}°\""
            {% else %}
              "p[9].b[7].bco=65535",
              "p[9].b[8].bco=65535",
              "p[9].b[9].pco=65535",
              "p[9].b[9].txt=\"\""
            {% endif %}
            ]              

#         topic: "hasp/devplate/command/p[9].b[9].txt"
#         payload_template: '" {{ state_attr("climate.thermostat", "temperature") }}°"'

  # Display current HVAC low temp set point on HASP when updated in Home Assistant
#  - alias: hasp_devplate_p3_UpdateHVACTempLow
#    trigger:
#      platform: state
#      entity_id: "climate.thermostat"
#    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/devplate/command/p[9].b[12].txt"
#          payload_template: '" {{ state_attr("climate.thermostat", "temperature") }}°"'

  # Increment HVAC high temp set point when p[9].b[7] is pressed
  - alias: hasp_devplate_p3_SetHVACTempHighPlus
    trigger:
      - platform: mqtt
        topic: "hasp/devplate/state/p[9].b[7]"
        payload: "ON"
    condition:
      condition: not
      conditions:
        - condition: state
          entity_id: climate.thermostat
          state: 'off'
    action:
      - service: climate.set_temperature
        entity_id: "climate.thermostat"
        data_template:
          temperature: '{{ state_attr("climate.thermostat", "temperature") + 1 | int}}'
#          target_temp_high: '{{ state_attr("climate.thermostat", "temperature") + 1 | int}}'
#          target_temp_low: '{{ state_attr("climate.thermostat", "temperature") | int}}'

  # Decrement HVAC high temp set point when p[9].b[8] is pressed
  - alias: hasp_devplate_p3_SetHVACTempHighMinus
    trigger:
      - platform: mqtt
        topic: "hasp/devplate/state/p[9].b[8]"
        payload: "ON"
    condition:
      condition: not
      conditions:
        - condition: state
          entity_id: climate.thermostat
          state: 'off'
    action:
      - service: climate.set_temperature
        entity_id: "climate.thermostat"
        data_template:
          temperature: '{{ state_attr("climate.thermostat", "temperature") - 1 | int}}'
#          target_temp_high: '{{ state_attr("climate.thermostat", "temperature") - 1 | int}}'
#          target_temp_low: '{{ state_attr("climate.thermostat", "temperature") | int}}'

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

  # Decrement HVAC low temp set point when p[9].b[11] is pressed
#  - alias: hasp_devplate_p3_SetHVACTempLowMinus
#    trigger:
#      - platform: mqtt
#        topic: "hasp/devplate/state/p[9].b[11]"
#        payload: "ON"
#    action:
#      - service: climate.set_temperature
#        entity_id: "climate.thermostat"
#        data_template:
#          target_temp_high: '{{ state_attr("climate.thermostat", "temperature") | int}}'
#          target_temp_low: '{{ state_attr("climate.thermostat", "temperature") | int - 1 }}'

##############################################################################
# Automations to set colors on HASP Page 9
#
  - alias: hasp_devplate_p3_ColorConfig_selectedforegroundcolor
    trigger:
      - platform: state
        entity_id: "binary_sensor.devplate_connected"
        to: "on"
      - platform: homeassistant
        event: start
      - platform: state
        entity_id: input_number.hasp_devplate_selectedforegroundcolor
    action:
      - service: mqtt.publish
        data:
          topic: "hasp/devplate/command/json"
          payload_template: >-
            ["p[9].b[4].bco={{ states('input_number.hasp_devplate_selectedforegroundcolor')|int }}",
            "p[9].b[5].pco={{ states('input_number.hasp_devplate_selectedforegroundcolor')|int }}",
            "p[9].b[6].pco={{ states('input_number.hasp_devplate_selectedforegroundcolor')|int }}",
            "p[9].b[11].pco={{ states('input_number.hasp_devplate_selectedforegroundcolor')|int }}",
            "p[9].b[12].pco={{ states('input_number.hasp_devplate_selectedforegroundcolor')|int }}"]
  - alias: hasp_devplate_p3_ColorConfig_selectedbackgroundcolor
    trigger:
      - platform: state
        entity_id: "binary_sensor.devplate_connected"
        to: "on"
      - platform: homeassistant
        event: start
      - platform: state
        entity_id: input_number.hasp_devplate_selectedbackgroundcolor
    action:
      - service: mqtt.publish
        data:
          topic: "hasp/devplate/command/json"
          payload_template: >-
            ["p[9].b[4].pco={{ states('input_number.hasp_devplate_selectedbackgroundcolor')|int }}",
            "p[9].b[5].bco={{ states('input_number.hasp_devplate_selectedbackgroundcolor')|int }}",
            "p[9].b[6].bco={{ states('input_number.hasp_devplate_selectedbackgroundcolor')|int }}",
            "p[9].b[7].pco={{ states('input_number.hasp_devplate_selectedbackgroundcolor')|int }}",
            "p[9].b[8].pco={{ states('input_number.hasp_devplate_selectedbackgroundcolor')|int }}",
            "p[9].b[9].bco={{ states('input_number.hasp_devplate_selectedbackgroundcolor')|int }}",
            "p[9].b[10].bco={{ states('input_number.hasp_devplate_selectedbackgroundcolor')|int }}",
            "p[9].b[11].bco={{ states('input_number.hasp_devplate_selectedbackgroundcolor')|int }}",
            "p[9].b[12].bco={{ states('input_number.hasp_devplate_selectedbackgroundcolor')|int }}"]
            
#            "p[9].b[10].pco={{ states('input_number.hasp_devplate_selectedbackgroundcolor')|int }}",
#            "p[9].b[11].pco={{ states('input_number.hasp_devplate_selectedbackgroundcolor')|int }}",
            
  - alias: hasp_devplate_p3_ColorConfig_unselectedforegroundcolor
    trigger:
      - platform: state
        entity_id: "binary_sensor.devplate_connected"
        to: "on"
      - platform: homeassistant
        event: start
      - platform: state
        entity_id: input_number.hasp_devplate_unselectedforegroundcolor
    action:
      - service: mqtt.publish
        data:
          topic: "hasp/devplate/command/json"
          payload_template: >-
            [{%- for i in range(4,9) -%}"p[9].b[{{i}}].pco2={{ states('input_number.hasp_devplate_unselectedforegroundcolor')|int }}"{% if not loop.last %},{% endif %}{%- endfor -%}]

#            [{%- for i in range(4,13) -%}"p[9].b[{{i}}].pco2={{ states('input_number.hasp_devplate_unselectedforegroundcolor')|int }}"{% if not loop.last %},{% endif %}{%- endfor -%}]

  - alias: hasp_devplate_p3_ColorConfig_unselectedbackgroundcolor
    trigger:
      - platform: state
        entity_id: "binary_sensor.devplate_connected"
        to: "on"
      - platform: homeassistant
        event: start
      - platform: state
        entity_id: input_number.hasp_devplate_unselectedbackgroundcolor
    action:
      - service: mqtt.publish
        data:
          topic: "hasp/devplate/command/json"
          payload_template: >-
            [{%- for i in range(4,13) -%}"p[9].b[{{i}}].bco2={{ states('input_number.hasp_devplate_unselectedbackgroundcolor')|int }}"{% if not loop.last %},{% endif %}{%- endfor -%}]

1 Like

Congratulations on the release!

very smooth!

I am however missing some of the older blueprints. namely the temperature w/o icon and the calendar without icon blueprint. Do you still have those around?

Also any chance for having the a blueprint for idle backlight off?

Works great with the blueprints. Compliments for the work done!
However in the ‘old’ situation it was possible to change the yaml files, this seems no longer possible with the blueprints.
I want to change the day / month to Dutch format.
In the yaml file i changed the corresponding line into:

payload_template: "\"{{now().day ~ '  ' ~ (now().strftime('%b')|replace('Mar', 'Mrt')|replace('May', 'Mei')|replace('Oct', 'Okt'))}} \""   

This does not work in the blueprint.
Is there a way to change code in the blueprints?

Regards, Peter.

Don’t know why the first lines are bold. This is my first post.

Sure! You can still use regular automations and hand-code the YAML, blueprints are just a way for me to get automations out to you in a way that’s easy for both of us.

Thanks for the reaction.
It seems the code should change in the blueprint, because the old (adapted by me) code does not work in the blueprint.
Any suggestions?
After this i shall change over to the github pages.

If you’re looking to modify a blueprint which you’ve imported, you can find it under homeassistant/blueprints/automation/HASwitchPlate. Make changes there, then do a “RELOAD AUTOMATIONS” under configuration > general to have your changes applied in Home Assistant.

2021-03-07 19.10.08|375x500

Found it and working.

@kuma I got around to installing Haspone on my device (and clearing all flash like you suggested) and it now works fine and remembers settings!

Trouble is importing the HASP Core functionality blueprint, it cannot find a device. Under “HASP Device” in the blueprint it says “no matching devices found”.

Under MQTT in integrations I have a device

HASP v1.0.0
by HASwitchPlate
Firmware: 0.41

It has entities (with their current state):

binary_sensor.plate01_connected on
light.plate01_backlight on
number.plate01_active_page 1
sensor.plate01_sensor ON

The attributes of the sensor are

espVersion: 0.41
updateEspAvailable: true
lcdConnected: true
lcdVersion: '3'
updateLcdAvailable: false
espUptime: 57660
signalStrength: -57
haspIP: 192.168.20.228
haspClientID: plate01-5ccf7fc17686
haspMac: '5c:cf:7f:c1:76:86'
haspManufacturer: HASwitchPlate
haspModel: HASP v1.0.0
heapFree: 23496
heapFragmentation: 2
heapMaxFreeBlockSize: 23088
espCore: '2_7_4'
friendly_name: plate01 sensor
icon: 'mdi:cellphone-text'

Clicking through the active_page seems to work and the backlight on/off works.I just cannot connect any blueprints.

It looks like you’re running the dev firmware - be sure to update both the ESP8266 and the Nextion LCD to the HASPone release and the release blueprints should work.