Component Type : platform
Platform Name : switcher_heater
Domain Name : sensor
Component Script : custom_components/switch/switcher_heater.py
This is a new version of this component which includes:
- State updates
- Timer services
- Configuration services</br>
If you're upgrading from a previous version of this component,</br>
please note the entities naming change in the Special Notes section.</br>
This custom component is based on the awesome script made available by NightRang3r, you can find the original script and the instruction on how to retrieve your device's information in Shai's repository here.
Table Of Contents
- Home Assistant version 0.62 or higher.
- Your switcher device needs to have a Static IP Address reserved by your router.
- Please follow Shai's instructions and gather the following information:
- phone_id
- device_id
- device_pass
- Copy file
custom_components/switch/switcher_heater.py
to yourha_config_dir/custom_components/switch
directory. - Configure like instructed in the Configuration section below.
- Restart Home-Assistant.
To use this component in your installation, add the following to your configuration.yaml
file, supports multiple devices:
# Example configuration.yaml
switch:
- platform: switcher_heater
switches:
your_device_name:
local_ip_addr: xxx-xxx-xxx-xxx
phone_id: "xxxx"
device_id: "xxxxxx"
device_password: "xxxxxxxx"
friendly_name: "your device friendly name"
scan_interval: 20
icon: "your local or mdi icon"
- local_ip_addr (Required): The IP Address assigned to your device by your router. A static address is preferable.
- phone_id (Required): Your phone id.
- device_id (Required): Your desiered device id.
- device_password (Required): Your device password.
- friendly_name (Optional): A string representing the friendly name of your device,
default="SwitcherV2 Device"
. - scan_interval (Optional): An integer representing the scan interval for the device, a minimum of 20 seconds is allowed,
default=20
. - icon (Optional): A string representing the display icon for the switch.
Available states are:
- on Inherited from homeassistant.const.STATE_ON
- off Inherited from homeassistant.const.STATE_ON
Please note, when the device in not reachable, Home Assistant will mark the switch as unavailable
. If it's a momentary issue, it will be resolved with the next scan, if not, please check your logs for any errors.
These following state attributes are available in all states:
- scan_interval: the scan interval retrieving the date from the device.
- ip_address: the ip address of the device.
- auto_off_configuration - the configured auto-shutdown limit of the device.
These following state attributes are available in on
state only:
- current_power_watts: the current power consumption in watts.
- current_power_amps: the current power consumption in amps.
- auto_off_time_left: the time left till auto-shutdown.
There are four timer services:
- switch.switcher_heater_turn_on_15_minutes
- switch.switcher_heater_turn_on_30_minutes
- switch.switcher_heater_turn_on_45_minutes
- switch.switcher_heater_turn_on_60_minutes
All four timer services allow turning on the device with a specific off timer, takes the following arguments:
- entity_id (Mandatory): allows 1 entity id or a List of entity id's
- notify_service_name (Optional):, a notification service to which the component will send turn on and off messages.
{
"entity_id": "switch.your_device_name",
"notify_service_name": "notify.my_notification_service_name"
}
{
"entity_id": ["switch.your_device_name", "switch.your_second_device_name"],
"notify_service_name": "notify.my_notification_service_name"
}
{
"entity_id": "switch.your_device_name"
}
{
"entity_id": ["switch.your_device_name", "switch.your_second_device_name"]
}
There is one configuration service:
- *switch.switcher_heater_set_auto_off
The service allows the configuring of the device Auto-Shutdown
option for limiting the time your device can be on
, takes the following arguments:
- entity_id (Mandatory): allows 1 entity id or a List of entity id's
- auto_off (Mandatory): allows to set hours and minutes only, seconds passed to the service will be ignored. minimum time allowed is 01:00 and maximum time is 23:59.
{
"entity_id": "switch.your_device_name",
"auto_off": "01:00"
}
{
"entity_id": "switch.your_device_name",
"auto_off": "23:59"
}
- If you’re upgrading this component from a previous version of it, PLEASE NOTE: The entity id is now based on the device id and not it's friendly name. Update your frontend accordingly.
- The use of multiple devices is supported.
The component provides standard log messages for the Logger Component, Warning
and Error
is visible in info
panel in Home Assistant. For Debug
logs that will show up in you .log file
please add the following to your Logger
configuration:
custom_components.switch.switcher_heater: debug
Example working configrations:
logger:
default: error
logs:
custom_components.switch.switcher_heater: debug
- A script by NightRang3r, here.