Added pool pump

This commit is contained in:
Martin Bauer 2019-07-04 22:51:04 +02:00
parent 43c4eb5a07
commit 71a27b7d67
2 changed files with 16 additions and 4 deletions

View File

@ -75,13 +75,14 @@ switch:
- name: Bad Lüfter
fhem_ids:
- Bad_Luefter
- name: Pool Pumpe
fhem_ids:
- SteckdosenSchalter_Sw
# ------------------------------ Motion Sensors ------------------------------------
binary_sensor:
- name: Arbeitszimmer Martin Bewegungsmelder Batterie
fhem_ids:
- ArbeitszimmerMartin_Bewegungsmelder
@ -91,8 +92,13 @@ binary_sensor:
- ArbeitszimmerMartin_Bewegungsmelder
fhem_sensor_type: motion
sensor:
- name: Arbeitszimmer Martin Bewegungsmelder Helligkeit
fhem_ids:
- ArbeitszimmerMartin_Bewegungsmelder
fhem_sensor_type: brightness
- name: Pool Pumpe Verbrauch
fhem_sensor_type: power
fhem_ids:
- SteckdosenSchalter_Pwr

View File

@ -16,7 +16,7 @@ _LOGGER = logging.getLogger(__name__)
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
vol.Required(CONF_FHEM_IDS): vol.All(cv.ensure_list, [cv.string]),
vol.Required(CONF_NAME): cv.string,
vol.Optional(CONF_FHEM_SENSOR_TYPE, default='brightness'): vol.In(('brightness',)),
vol.Optional(CONF_FHEM_SENSOR_TYPE, default='brightness'): vol.In(('brightness', 'power')),
})
@ -42,7 +42,6 @@ class FhemSensor(Entity):
self._type = sensor_type
self._available = True
self._state = None
self._unsubscribe_motion_off = None
@property
def name(self):
@ -67,6 +66,11 @@ class FhemSensor(Entity):
_, new_value = line.split(':')
self._state = int(float(new_value) / 255 * 100)
await self.async_update_ha_state()
elif self._type == 'power':
self._available = True
_, new_value = line
self._state = int(new_value)
await self.async_update_ha_state()
elif line.startswith('ResndFail') or line.startswith('MISSING ACK'):
self._available = False
await self.async_update_ha_state()
@ -81,3 +85,5 @@ class FhemSensor(Entity):
def unit_of_measurement(self):
if self._type == 'brightness':
return '%'
elif self._type == 'power':
return 'W'