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

Is anyone else facing these issues? Just set everything up like described. Mqtt successfully connected. But the blueprints do not run through. You talked about a warning before. I receive an error where the automation does not complete. Thanks :pray:

1 Like

After applying the latest HA April version I’m getting errors running the core functionality blueprint. I pulled the latest blueprint off GH and not able to full initialize a new HASPOne node. Here is the error I’m getting.

2021-04-09 23:37:48 INFO (MainThread) [homeassistant.components.automation.hasp_plate_03_core_functionality] HASP Plate 03 Core functionality: Choose at step 1: choice 2: Executing step call service

2021-04-09 23:37:48 INFO (MainThread) [homeassistant.components.automation.hasp_plate_03_core_functionality] HASP Plate 03 Core functionality: Running automation actions

2021-04-09 23:37:48 INFO (MainThread) [homeassistant.components.automation.hasp_plate_03_core_functionality] HASP Plate 03 Core functionality: Choose at step 1: choice 3: Running automation actions

2021-04-09 23:37:48 INFO (MainThread) [homeassistant.components.automation.hasp_plate_03_core_functionality] HASP Plate 03 Core functionality: Choose at step 1: choice 2: Executing step call service

2021-04-09 23:37:48 ERROR (MainThread) [homeassistant.helpers.template] Template variable error: 'jinja2.utils.Namespace object' has no attribute 'source' when rendering '{%- 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 -%}]'

2021-04-09 23:37:48 ERROR (MainThread) [homeassistant.components.automation.hasp_plate_03_core_functionality] HASP Plate 03 Core functionality: Choose at step 1: choice 2: Error executing script. Error for call_service at pos 2: Error rendering data template: UndefinedError: 'jinja2.utils.Namespace object' has no attribute 'source'


This looks to be something related to the HA update but I’m not sure.

1 Like

This is super helpful, I can now re-create this in my dev environment and am working on tracking down what the heck is going on. Thanks @oday and @navierstokes!

edit: got a handle on what is happening. This is a breaking change with the new release that wasn’t listed as a breaking change. Previously, when “RUN ACTIONS” was pressed, trigger wasn’t defined and I could catch that and do things in response. With this release, trigger is now defined, which I can also catch but requires changing the logic on a lot of the blueprints. This is going to take me an hour or so to dig through, update, and test.

ahh okay!
another thing i noticed is that the mqtt integration just creates 3 entities instead of 6 (color select and unselect e.g.)… Dont know if that helps. :slight_smile:

Yeah, those are created by the Core automation, but aren’t being made for you because it’s broke :expressionless:

1 Like

Calling out for help, nothing I’m trying thus far seems to catch this behavior with the new breaking changes in 2021.04.

Allright, calls for help have gone unanswered but I have an ugly solution that appears to work. The repo has been updated with all impacted blueprints changed to deal with this new behavior, while still working with the pre-2021.04 behavior.

I have no idea if this approach is going to work in October when this behavior is set to change yet again.

Have I mentioned how much I love breaking changes?

edit: welp - still some errors, continuing to troubleshoot.

edit2: errors resolved, github updated again.

1 Like

Thanks, it’s partially working again! There is still an issue with the lovelace card generation being incomplete but it looks like it has to do with not all the entities being created by the Core Functionality blueprint.

Invalid entity ID at position 4: null
type: entities
title: HASP hasp_plate_04
show_header_toggle: false
state_color: true
entities:
  - entity: number.hasp_plate_04_active_page
  - type: divider
  - entity: light.hasp_plate_04_backlight
    secondary_info: brightness
  - type: divider
  - entity: null
    icon: 'mdi:palette'
    name: Selected Foreground Color
    secondary_info: brightness
  - entity: null
    icon: 'mdi:palette'
    name: Selected Background Color
    secondary_info: brightness
  - entity: null
    icon: 'mdi:palette'
    name: Unselected Foreground Color
    secondary_info: brightness
  - entity: null
    icon: 'mdi:palette'
    name: Unselected Background Color
    secondary_info: brightness
  - type: divider
footer:
  type: buttons
  entities:
    - entity: sensor.hasp_plate_04_sensor
      name: Blueprints
      icon: 'mdi:palette-swatch'
      tap_action:
        action: navigate
        navigation_path: /config/blueprint/dashboard
    - entity: sensor.hasp_plate_04_sensor
      name: Automations
      icon: 'mdi:robot'
      tap_action:
        action: navigate
        navigation_path: /config/automation/dashboard
    - entity: sensor.hasp_plate_04_sensor
      name: HASP Admin
      icon: 'mdi:cellphone-text'
      tap_action:
        action: url
        url_path: 'http://192.168.100.140

That does appear to be the problem. At the bottom of the core blueprints you have deployed, enable “First-time HASP setup or reset”, click Save, then hit “RUN ACTIONS”. That should create the missing parts for you (which didn’t work the first time due to the issues above).

Thanks that took care of it. Is there a race condition on the initial setup between the parallel paths? I noticed there was a delay on the lovelace card creation.

There are a few delays in the blueprint to allow things like the HASPone device reboot to complete in time. Glad to hear it worked out!

1 Like

Im new to Hasplate… can someone show me how to fix the problem im facing… mqtt connects on the 1st upload of the bin file to my d1 mini lite… however if i restart or unplug and replug the d1 mini… its not connecting anymore to mqtt… and wants me to input again the mqtt username and pass to the webgui… but after inputting the right credentials, mqtt never connect again unless i re upload the bin file to the d1 mini lite… im always stuck on “Configure MQTT:” screen on the nextion display…

heres the error on mosquitto broker logs
1618169133: New connection from 172.30.32.1 on port 1883.
1618169133: Socket error on client , disconnecting.

Might be a bad flash. Try following this guide (particularly, the “erase flash” bit) and see if maybe that helps you out.

Check out this on github GitHub - HASwitchPlate/openHASP: HomeAutomation Switchplate based on lvgl for STM32F407, ESP32 & ESP8266
got 2 wt32-sco1 3.5 plates up and running with this code just waiting for gpios to be integrated then going full in.

2 Likes

Thank you very much. That sorted it. I had tried re-flashing a few times but not wiping first.

i tried reflasing again… using the provided link… yes wipe all data with the lastest bin file… mqtt connects for the 1st time but after i reset the d1 mini… it says “configure mqtt” again… then never connects to the mosquito broker.

im using d1 mini lite… does it make any difference? i know the d1 mini lite has less flash memory… maybe it doesn’t have enough memory to save my mqtt settings after restart. or i could be wrong?

That may very well be the case, the BOM has been pretty carefully selected for the features this project uses. Can you get a hold of a standard D1 mini?

i ordered the standard d1 mini yesterday… it would take a week for it get deliver… by the way im from philippines and im enjoying this project… :slight_smile:

im lucky to find a nodemcu lying around and tried to flash again… but this time with success! im using a nextion 3.5 basic… i also modify the hmi files and make it a little bit larger resolution to fit the 3.5 display… the problem now is im having a hard time positioning the icons… by the way my button height is 94… if that can help sort things out… thanks again luma… this is really cool!

Hey luma… i was wondering how can i put icon buttons like this with your ha switch plate? my simple goal is when i press the icon the color change… and even if i turn ON a light on a physical switch… the icons on the nextion will update its status and change its color too…

any idea how can i achieve this? thanks!