Change device class for Siren

I have bought a WiFi Siren made by ENER-J and connected it to my system via the Tuya app, all is working fine via the app but HA is seeing the divice as a “device.tracker” (device_tracker.esp_d62321) so I’m been unable to automate it as a Siren. Is there a way I can change what a device is recognized as within HA. So ideally change it so HA sees it as a Siren or even a light or a switch.

Perhaps you can create a template binary sensor that mimics the state of the device tracker (home = on, anything else is off). You can then use the device class attribute.

Thanks for the advice, would it be possible for you to give me an example of how you think it should be done as I’m struggling

This is how the siren is seen in known devices.yaml

esp_d62321:
  hide_if_away: false
  icon:
  mac: xx:xx:xx:xx:xx:xx
  name: ESP D62321
  picture:
  track: true

Can I edit or add any info to this?

I thought about creating a person called Ener-J Siren

Assuming your sensor has a name of device_tracker.esp_d62321, the template sensor could be specified like this:

binary_sensor:
  - platform: template
    sensors:
      esp_d68321:
        value_template: "{{ is_state('device_tracker.esp_d62321', 'home') }}"

This will give you a binary_sensor.esp_d68321 with a state of on or off.

You can then customize the device class of the sensor to, for example, sound.

Thankyou, I’ll give it a try.

I’ve had it working today by creating a Smart Scene within the Tuya app which HA then sees which I have then setup in an automation

Where do I put your suggested yaml file, in configuration.yaml, customize.yaml or other. I’ve tried in config.yaml and I get error
Invalid config for [binary_sensor]: required key not provided @ data[‘platform’]. Got None. (See /config/configuration.yaml, line 236). Please check the docs at https://home-assistant.io/integrations/binary_sensor/

and in customize.yaml I get error
extra keys not allowed @ data[‘customize’][‘binary_sensor’]

I realize I made an error and corrected the above code to include the platform. This block of code should be in your configuration.yaml.

That’s worked thanks and I can now see it as a sensor but I’m still struggling to see how I turn it on / off via an automation.
Would it be possible to change its device type to a switch

Thanks for all your help and patience

Ah. I didn’t know that you wanted to manually enable the siren. In that case you would want know with which state the siren sounds. I assume ‘home’?

In that case you can use an automation to use the device_tracker.see service to manually change the entity state:

I’m sorry if I’m confusing things

At the moment my wireless siren is seen as a device tracker in HA so when it is powered but NOT sounding it shows as:

entity: device_tracker.esp_d62321
state: home
source_type: router
latitude: 54.5479626
longitude: -1.2665515
gps_accuracy: 0
scanner: BTSmartHubScanner
friendly_name: Ener-J Siren

I would like to be able to set an automation (any automation such as activating an open close sensor on a door) to tell the device to activate (make a sound)

The problem is all caused by HA seeing the siren as a tracker rather than something like a switch

From the above it looks like the entity is created from a device tracker integration (some router).

You should (also) install ESPHome and add your device trough there. Both integrations can co-exist for the device.

1 Like

You can create 2 scenes in the tuya app (one the siren ringing, one the siren off) and use an action like this :

  action:
  - data:
      entity_id: scene.siren_ringing
    service: scene.turn_on
  action:
  - data:
      entity_id: scene.siren_off
    service: scene.turn_on
1 Like

I’ve installed ESPHome but it asks for me to setup a node and makes reference to custom firmware which I don’t require. I’m sure you can tell that I’m a little out of my depth here. SORRY!