Expose power sensor to Google Assistant

I created a sensor template that reads the power consumption from a smart plug.

sensor:
  - platform: template
    sensors:      
      boiler_pwr::
        friendly_name: "Boiler Consumption"
        device_class: power
        value_template: >-
          {{ states.switch.boiler.attributes.current_consumption }}
        unit_of_measurement: 'W'
        icon_template: mdi:gauge

If I set the device_class to ‘power’ (or if I don’t set it entirely) it doesn’t show in the Google Assistant app (which I integrated the manual and free way).

It works if I expose it as a temperature (which is wrong, but I tried just as a test).

What’s the best workaround for this?

What I would like to do is ask my google assistant how much power is the sensor reading.

Is there a way to just have a generic “variable” exposed to Google Assistant? Like "hey google what’s the value of VARIABLE?

It would be useful not just for power metering but to know the status of anything really

I have solved all those issues with booleans and Google routines.
Create a routine with a friendly phrase to set the boolean and that triggers an automation that tts a message.

You can’t specify to tts to the same speaker as you asked but I tts to the two main speakers and that is good enough.

1 Like

Yes, that’s brilliant. I wonder if there’s a workaround for the speaker issue

I read something about playing a white noise sound after each command but I haven’t figured out how that’s supposed to set up yet.

Found it: Script to send TTS to the right Google Home (based on voice commands)

2 Likes

Interesting… can you provide your yaml code? I want to know the status of a battery sensor, but GA only supports device class for temperature and humidity… so maybe TTS is a workaround… I don’t want to customize my sensor, don’t want to ask how many degree my battery sensor is :slight_smile: