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

I thought I’d post about getting the media page to work with Sonos as have had an irritating experience which, as usual, turns out to be something stupid!

I had been playing around with lots of alternatives for setting up the media player sensor and reading forums re spaces, ’ and " marks etc. Nothing seems to work.

I had forgotten I had created a plate01 and plate02 and in the packages setup both create their own sensor. Because plate02 was the one that ‘won’ it the artist name and artist title stayed the same as “Artist Name”. Changing the sensor to a unique name sorted this out.

I think what I will do is create a new yaml which ‘centrally’ defines a sensor for each of my media devices.

For the record this is now my sensor setup although it is the same as default!

sensor:
  - platform: template
    sensors:
      media_player_title2:
        value_template: '{{ states.media_player.dining_room.attributes.media_title }}'
      media_player_artist2:
        value_template: '{{ states.media_player.dining_room.attributes.media_artist }}'
      media_player_volume:
        value_template: '{{ states.media_player.dining_room.attributes.volume_level }}'

i have the v1 boards still but not got any complete units left

Do you have nest working in HA? Google recently removed the API for nest; legacy developer licenses will work but not for long. Annoying as I like my nest but want to be able to link it to HA and don’t really want to buy a replacement!

Hi @luma. Love this. Getting it to work well. Works way better now I’ve updated from Pi3 to 4.

One Q - you mention in the ESP v0.4 code that you added support for haptic / audio - I assume this is the " *Keypress beep enabled" in the plate setup. Is there any documentation for this, especially which haptics you tried and how to wire to the ESP (pretty new to this!)

Cheers

@luma Printing a case for another HASP and it seems the holes for the brass inserts are a bit too big to get a good fit. I am using the inserts linked to in the documentation and had issues with another case with one insert always falling out. I tried using the sketch-up file, but it is not loading. Says it is not a sketch-up file. Reducing the main hole size by a mm should fix it.

UPDATE: I was able to edit the STL file using OpenSCAD. Reducing the diameter by 0.5mm made a much tighter fit.

That feature is still experimental and subject to change, the PR conversation here explains a bit more about what’s going on. For the moment, I might recommend ignoring this until it works itself out. If you’re still like to proceed, a 3.3v buzzer or tactile motor controller could be connected to D2, and the following MQTT command should trigger the beep:

-t 'plate01/device/command/beep' -m '[ontime],[offtime],[count]'

For example, to beep 3 times with 100ms beeps 200msec apart:

-t 'plate01/device/command/beep' -m '100,200,3'

Again… all of this is subject to change so keep in mind you may need to re-do some of this once I finally commit to getting this sorted in a more general-purpose manner.

Printer tolerances vary pretty widely. I have two Prusa printers and they both print the holes in the model for the inserts at the correct size, just slightly undersized enough that I can force the insert in but with enough material around the edges to keep it there.

Sounds like you solved this w/ the STLs, but for others reading this, try scaling the model slightly in your slicer if things aren’t printing out to the correct size. Alternatively, run through an stepper calibration process on your X and Y axis to confirm things are printing on-size.

Brilliant. Might have a play but subject to change noted!

As an alternative the code below uses the big button on p11 as a button to allow ‘fumble anywhere on the screen in the dark’ which then sets the brightness and goes to p1. I’m not sure it’s ‘better’ than the above, just an alternative, but is simpler so I didn’t break things!

Planning to use other code posted here to also adjust the brightness according to time of day - at the moment it just activates when the ‘nighttime’ switch is on.

##############################################################################
# Automations for switching brightness on/off

#Timer 
timer:
  hasp_plate01:
    duration: '00:00:05'

automation:
#Sets Turns Screen On and Sets Page to 1 when big button on p11 is pressed
- alias: hasp_plate01_00_TimerSet
  trigger:
  - platform: mqtt
    topic: 'hasp/plate01/state/p[11].b[4]'
    payload: "OFF"
  action:
  - service: mqtt.publish
    data:
      topic: 'hasp/plate01/command/page'
      payload: '1'
  - service: mqtt.publish
    data:
      topic: 'hasp/plate01/brightness/set'
      payload: '255'
  - service: timer.start
    data:
      entity_id: 'timer.hasp_plate01'

#Reverts to p11 and dims brightness when timer expires if it's nighttime
- alias: hasp_plate01_00_BacklightBright_TimerEnd
  trigger:
  - platform: event
    event_type: timer.finished
    event_data:
      entity_id: timer.hasp_plate01
  condition:
  - condition: state
    entity_id: 'switch.nighttime'
    state: 'on'
  action:
  - service: mqtt.publish
    data:
      topic: 'hasp/plate01/brightness/set'
      payload: '0'
  - service: mqtt.publish
    data:
      topic: 'hasp/plate01/command/page'
      payload: '11'


#Resets the timer when another button is pressed
- alias: hasp_plate01_00_BacklightBright_TimerReset
  trigger:
  - platform: mqtt
    topic: 'hasp/plate01/state/#'
  action:
  - service: timer.start
    data:
      entity_id: 'timer.hasp_plate01'
2 Likes

Im missing something how do i get the motion sensor to work. ive check the box initial setup found and old post with an automation but no motion sensor is showing up. anybody have an updated guide on getting it running.
thx again love this thing, slowly replacing all my sonoff t1 t3 tasmota switches.

ps anybody have a 3d 2 guang model that would work with sonoff t1 t3 looks funny with the gap.

Hi, just finished assembling the project and powered it up. Most of the time, after the QR Code, it will say connected to my wifi but gives an RC 0 or 6 when trying to connect to my MQTT (Mosquitto). From time to time, it does connect but will fail later on. No other devices give me that problem. Any idea what a return code of 0 or 6 means for MQTT?

Thanks.

That’s a head scratcher, because according to this… RC=6 shouldn’t happen :frowning: Any chance you grabbed a debug log while this was happening?

No, but since I added the HASP automations to my setup, my IO Wait state on my raspberrypi 3b was often in the 90% and load average was in the 4x :frowning: I’ve deactivated those that I didn’t need and deactivated the logger, history and recorder for the time being. It’s been stable since then so this could have been the cause of the issue. I’m wondering though how often do the HASP talk to its MQTT when idle? My Tasmota devices talk once every 30 seconds unless and event has happened and none rebooted.

My SD card is a genuine Samsung EVO Select 64 GB but I used to run off a Kingston SSD until it crapped out last week and I’m waiting a replacement SSD which should arrive tomorrow. Once I’m back on SSD, I’ll see if I still have issues with my wait state.

Hi, I have a quick question, I am wanting to add a few displays, can you tell me do I need too change all the ref in the info file to the plate name ie plate01 to whatever I want to use for the other displays?
also do I then need to refer to that new name in all the automations associated with that display

as I have tried the above using the same TFT file on another display and it has problems connecting to MQTT when it does, the ages do not come up on the new display
thanks
Simon

The TFT (Nextion firmware) and the Arduino sketch won’t need any changes to deploy multiple HASPs. On the HASP web page you can set a device name. Change that name to some new, unique value, and then run deployhasp.sh with a new device name. It will deploy the automations and replace plate01 with the new name. That’s it!

Thankyou, for the info, I have modified the original automations quite a bit, so would rather copy those and then change the ref to plate01 to the new name, I gather that should work rather than starting from scratch with the original automations and re modifying should that work ok.

by the way have have been playing with the 7inch intelligent displays, and have managed to use a 3d plan of my house and the lights etc work by touching the image the image for that area lights up this is in the same way as the floorplan project works

another Q. have you gone any further with the keypress beep, and light sensor for turning the display on and off, if so is there any documentation on the IO ports used and how it is configured program wise

For the beep you can see this post above. No plans for a direct-attach light sensor but if you have an existing light sensor in the room you can use that to control HASP through normal automations.

sorry meant motion sensor not light sensor :slight_smile:

There is one other thing that has confused me all along that hopefully you can set me straight, and that is with referencing the ID name and Objname in the code eg P1 B1. page 1 button 1. is the button 1 referring to the ID or the objname, or both, can I just refer to the object name, as I have noticed as you move things around the ID name changes depending if your adding buttons oe deleting them, this changes the whole button numbering sequence, or am I misunderstanding it