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

With just the color code, the color still doesn’t change.

[+4386.274s] MQTT IN: 'hasp/desktop/command/json' : '[
                                                        "page 1"
                                                                ]'
[+4386.281s] HMI OUT: page 1
[+4386.445s] MQTT IN: 'hasp/desktop/command/json' : '[
                                                        "p[1].b[4].bco=2016"
                                                                            ]'
[+4386.453s] HMI OUT: p[1].b[4].bco=2016
[+4386.482s] HMI IN: [5 bytes]: 0x66 0x01 0xff 0xff 0xff
[+4386.488s] HMI IN: [sendme Page] '1'
[+4386.492s] MQTT OUT: 'hasp/desktop/state/json' : '{"event":"page","value":1}'
[+4386.500s] MQTT OUT: 'ha▒p/desktop/state/page' : '1'

Okay. This is strange. Just tried again with the same code that didn’t set the color, but this time, it did.

[+6098.239s] MQTT IN: 'hasp/desktop/command/json' : '[
                                                        "page 1"
                                                                ]'
[+6098.247s] HMI OUT: page 1
[+6098.250s] MQTT IN: 'hasp/desktop/command/json' : '[
                                                        "p[1].b[4].txt=\"Mail's In\"",
                                                                                        "p[1].b[4].bco=2016"
                                                                                                            ]'
[+6098.260s] HMI OUT: p[1].b[4].txt="Mail's In"
[+6098.446s] HMI IN: [5 bytes]: 0x66 0x01 0xff 0xff 0xff
[+6098.452s] HMI IN: [sendme Page] '1'
[+6098.456s] MQTT OUT: 'hasp/desktop/state/json' : '{"event":"page","value":1}'
[+6098.465s] MQTT OUT: 'hasp/desktop/state^page' : '1'
[+6098.471s] HMI OUT: p[1].b[4].bco=2016

Then running it again, color didn’t change.

[+6269.132s] MQTT IN: 'hasp/desktop/command/json' : '[
                                                        "page 1"
                                                                ]'
[+6269.140s] HMI OUT: page 1
[+6269.143s] MQTT IN: 'hasp/desktop/command/json' : '[
                                                        "p[1].b[4].txt=\"Mail's In\"",
                                                                                        "p[1].b[4].bco=2016"
                                                                                                            ]'
[+6269.154s] HMI OUT: p[1].b[4].txt="Mail's In"
[+6269.340s] HMI IN: [5 bytes]: 0x66 0x01 0xff 0xff 0xff
[+6269.346s] HMI IN: [sendme Page] '1'
[+6269.349s] MQTT OUT: 'hasp/desktop/state/json' : '{"event":"page","value":1}'
[+6269.358s] MQTT OUT: 'hasp/desktop/state/page' : '1'
[+6269.364s] HMI OUT: p[1].b[4].bco=2016

Was able to get the line endings worked out, but still no luck.

[+12182.997s] HMI IN: [7 bytes]: 0x65 0x01 0x04 0x01 0xff 0xff 0xff
[+12183.004s] HMI IN: [Button ON] 'p[1].b[4]'
[+12183.009s] MQTT OUT: 'hasp/desktop/state/p[1].b[4]' : 'ON'
[+12183.015s] MQTT OUT: 'hasp/desktop/state/json' : '{"event_type":"button_short_press","event":"p[1].b[4]","value":"ON"}'
[+12183.049s] MQTT IN: 'hasp/desktop/command/json' : '["p[1].b[4].font=7","p[1].b[4].txt=\"No Mail\"","p[1].b[4].bco=0"]'
[+12183.061s] HMI OUT: p[c].b[4].font=7
[+12183.067s] HMI OUT: p[1].b[4].txt="No Mail"
[+12183.071s] HMI OUT: p[1].b[4].bco=0
[+12183.089s] MQTT IN: 'hasp/desktop/command/page' : '2'
[+12183.096s] HMI OUT: page 2
[+12183.285s] HMI IN: [5 bytes]: 0x66 0x02 0xff 0xff 0xff
[+12183.291s] HMI IN: [sendme Page] '2'

If it is of any help, here is the action part of the automation for the above output:

  action:
  - service: mqtt.publish
    data:
      topic: hasp/desktop/command/json
      payload_template: "[\"p[1].b[4].font=7\",\"p[1].b[4].txt=\\\"No Mail\\\"\",\"p[1].b[4].bco={{ states('light.light.desktop_selected_background_color')|int }}\"]"

Luma,

Thanks for sharing your project “HASPone”! I have assembled my first plate a few days ago and having a good time setting it up, thanks for the excellent doc’s! It helped this novice weekend programmer, a Lot.

I have a question and concerns about the Heatpump Control page’s I would like to ask about.

I have a generic thermostat setup using a Tasmota device (wemos/relay/temp sensor). This is a simple “bang, bang” thermostat with no cooling capability. It is setup within HA as such:

climate:
  - platform: generic_thermostat
    name: House heat
    heater: switch.thermostat_main
    target_sensor: sensor.thermostat_1_temperature
    min_temp: 50
    max_temp: 79
    ac_mode: False
    target_temp: 70
    cold_tolerance: 0.5
    hot_tolerance: 0.5
    min_cycle_duration:
      seconds: 45
    keep_alive:
      minutes: 3
    initial_hvac_mode: "heat"
    away_temp: 63
    precision: 0.1

I’m receiving warnings within the HASS log after setting up ether Heatpump blueprint. The warning is:

2021-04-25 17:11:22 WARNING (MainThread) [homeassistant.helpers.template] Template variable warning: 'hp_is_off' is undefined when rendering '{%- if hp_is_off -%}heat_cool{%- else -%}off{%- endif -%}'

I’m guessing that since my thermostat does not have cooling capability its not exposing the necessary “heat_cool” variables for the script to work correctly, Maybe.
At least that’s my novice/weekend programmer thinking.

I’m I on the right track?

Also a heads up.

I noticed that the blueprint’s “hasp_Display_Heatpump_Control_page6.yaml” and “hasp_Display_Heatpump_Control_page9.yaml” are missing a preview image “ https://raw.githubusercontent.com/HASwitchPlate/HASPone/main/images/hasp_Display_Heatpump_Control_page9.png ” .

bp-hp-Capture

Again Many thanks for sharing your project. And the excellent Doc’s.

I seem to recall that someone designed a new desktop base that is narrower than the existing one. I can’t seem to find it. Does anyone know where the STL for this can be found?

Thank you.

Looks like this might be something I just have to live with. The fan never sets the speed to off. If the fan is on and you set the speed to off, it just sets the fan state to off leaving the speed set to whatever it was. :frowning: I am using an iFan03 with tasmota. There probably is a way to modify the configuration, but I’m not that versed with tasmota.

I found an ESPHome configuration for the iFan03 but it shows the same behaviour. Speed is left to the last selected speed and the state is set to off. Seems like the blueprint/automation needs to be able to check multiple conditions for the on state.

You can manually set the speed state to off whenever the fan state changes to off using an automation. I used to do this. Have a look here Change entity state through automation? - #2 by 123

What I am needing to change is an attribute. The speed value never gets set to off. The state goes to off when I set the speed to off, but the attribute stays at the last setting.

You could use this Python script (from HACS) to update the attribute GitHub - pmazz/ps_hassio_entities: Python script to handle state and attributes of existing sensors and entities

Still no joy. I think the problem is going to be the possible values for speed does not include ‘off’. :frowning:

I don’t have this problem with my ifan3. Are you running stock firmware? How have you integrated it?

I have tried both Tasmota and ESPhome. Using the old HASP automation, it worked fine. It could check both state and speed. The blueprints only allow you to check one item.

I have a issue with the Core Blueprint and a HASPOne V1.01

When running the Core Blueprint a get the following error:

Error: Error rendering data template: UndefinedError: None has no element 0

From the trace it comes from this section of the blueprint:

service: mqtt.publish
data:
  topic: '{{jsoncommandtopic}}'
  payload: >-
    {%- set color = namespace() -%} {%- for entity in
    device_entities(haspdevice) -%}
      {%- if entity|regex_search("^light\..*_selected_foreground_color(?:_\d+|)$") -%}
        {%- set color.source=entity -%}
      {%- endif -%}
    {%- endfor -%} {%- set brightness = state_attr(color.source,
    "brightness")|int / 255 -%} {%- set red=(state_attr(color.source,
    "rgb_color")[0] * brightness)|int -%} {%- set
    green=(state_attr(color.source, "rgb_color")[1] * brightness)|int -%} {%-
    set blue=(state_attr(color.source, "rgb_color")[2] * brightness)|int -%} {%-
    set colorcode = (red|bitwise_and(248)*256) + (green|bitwise_and(252)*8) +
    (blue|bitwise_and(248)/8)|int -%} [{%- if not page_scroll -%}{%- for p in
    range(1,12) %}{%- if p == page1page|int
    %}"p[{{p}}].b[1].pco={{colorcode}}"{%- else
    -%}"p[{{p}}].b[1].pco2={{colorcode}}"{%- endif -%},{%- endfor -%} {%- else
    -%}{%- for p in range(1,12) %}"p[{{p}}].b[1].pco2={{colorcode}}",{%- endfor
    -%}{%- endif -%} {%- for p in range(1,12) %}{%- if p == page2page|int
    %}"p[{{p}}].b[2].pco={{colorcode}}"{%- else
    -%}"p[{{p}}].b[2].pco2={{colorcode}}"{%- endif -%},{%- endfor -%} {%- if not
    page_scroll -%}{%- for p in range(1,12) %}{%- if p == page3page|int
    %}"p[{{p}}].b[3].pco={{colorcode}}"{%- else
    -%}"p[{{p}}].b[3].pco2={{colorcode}}"{%- endif -%}{% if not loop.last %},{%
    endif %}{%- endfor -%} {%- else -%}{%- for p in range(1,12)
    %}"p[{{p}}].b[3].pco2={{colorcode}}"{% if not loop.last %},{% endif %}{%-
    endfor -%}{%- endif -%}]

I do get 4 entities created under the device:
unselected/selected foreground/background entities.

Nothing else and the device doesn’t take the initial config.

Any help would be appreciated.

Thanks

I was experiencing the same error when setting up my second plate. However I think I have found a workaround.

Try this:
After adding the core blueprint (if you removed it). Add one of the three theme blueprints and configure it for the plate, save and run.

Then re-add the core blueprint, save and run. it should be fine now and show the notification for the card configuration as well.

I tried this on my first plate I set up as well. After wiping out it’s config and starting from scratch and encountering the same error again.

There have been a couple reports of an issue that looks like this, and I’m trying to wrap this up into a thread here.

If you get a minute, try running through the process outlined there and let us know how it goes.

Allright I think I have a solid fix for this that should hold up in the future. Once we have some folks confirm this test release works for them it’ll be rolled into a 1.02 release.

If you can, it’d help me out if you can test the new release! Here’s the deal:

edit: test looks good, moved 1.02 to release!

HASPone v 1.02 upgrade procedure

  1. HASPone web admin > Update Firmware > Update ESP8266 from URL, then click “Update ESP from URL” and allow the firmware update to complete
  2. In Home Assistant, go to Configuration > Blueprints and hit the trash can icon next to “HASP Core functionality” to delete the existing copy.
  3. Click this here button to deploy the 1.02 version of the Core Functionality blueprint:
    Open your Home Assistant instance and show the blueprint import dialog with a specific blueprint pre-filled.
  4. Finally, go to Configuration > Server Controls > YAML configuration reloading > Automations to reload the core functionality blueprints+automations.

Thanks Luma, This work perfect.
i have started over everything again. used to follow you since HA SwitchPlate
and this really made everything to edit easier.

i wonder if you can make the select multiple device for HASPone device when doing automation?
because i have 2 set of plate that has everything identical. of only i can select multiple device, i can only add one automation.

As of now, probably not. This is due to a combination of how the Home Assistant selectors work, and also how the blueprints themselves are architected. Maybe sometime in the future, but not currently on the roadmap.

I’d suggest making liberal use of “duplicate automation”. Get one plate geared up the way you like, then go and duplicate each of the resulting automations but targeting the second plate.