al-one / hass-xiaomi-miot

Automatic integrate all Xiaomi devices to HomeAssistant via miot-spec, support Wi-Fi, BLE, ZigBee devices. 小米米家智能家居设备接入Hass集成
https://miot-spec.com
Apache License 2.0
4.63k stars 659 forks source link

ymt.flowerpot.v1 missing parameters. #588

Open bimodinochka opened 2 years ago

bimodinochka commented 2 years ago

Good day, I found a problem in the parameters.

  1. There is no soil quality sensor (Fertility)
  2. There is no plant status sensor from 1 to 100. (I do not know if it is possible to get it).
  3. There is no (very important function) switch for watering plants.
  4. There is no (very important function) water level sensor.

If you need tests or some data, I am ready to help.

al-one commented 2 years ago

Show me the entity state attributes.

Same of other issues.

bimodinochka commented 2 years ago

Show me the entity state attributes.

Same of other issues.

Here are the attributes, as you can see there are no necessary attributes.

model: ymt.flowerpot.v1

lan_ip: MY IP
mac_address: MY MAC
entity_class: MiotSensorEntity
miot_type: urn:miot-spec-v2:device:flowerpot:0000A047:ymt-v1:2
state_property: plant_monitor.temperature
plant_monitor.temperature: 28
plant_monitor.relative_humidity: 51
plant_monitor.illumination: 12
fill_light.on.error: -4004 Other internal errors
fill_light.mode.error: -4004 Other internal errors
fill_light.support.error: -4004 Other internal errors
othersetting.light.error: -4004 Other internal errors
othersetting.start_date.error: -4004 Other internal errors
othersetting.matrix.error: -4004 Other internal errors
othersetting.love_value.error: -4004 Other internal errors
othersetting.water_count: 147
othersetting.cumulative_harvest: 1
othersetting.begin_date: 1610086043
othersetting.manual_refresh: false
othersetting.report_night.error: -4004 Other internal errors
othersetting.light_low_limit.error: -4004 Other internal errors
othersetting.fill_light.error: -4004 Other internal errors
safe.safe_temperature.error: -4004 Other internal errors
safe.safe_humidity.error: -4004 Other internal errors
safe.safe_illumination.error: -4004 Other internal errors
safe.safe_fertility: 0,1579
data.fertility.error: -4004 Other internal errors
data.water.error: -4004 Other internal errors
data.water_count.error: -4004 Other internal errors
data.type.error: -4004 Other internal errors
data.type_new.error: -4004 Other internal errors
flowerpot.mode.error: -4004 Other internal errors
flowerpot.watering.error: -4004 Other internal errors
flowerpot.fault.error: -4004 Other internal errors
state_updater: lan
sub_entities: plant_monitor-6.relative_humidity-4, plant_monitor-6.illumination-6
unit_of_measurement: °C
device_class: temperature
friendly_name: Температура
supported_features: 0

But I can get the water level in notifications via:

service: xiaomi_miot.get_properties
data:
  entity_id: sensor.ymt_v1_aff9_temperature
  mapping:
    data:
      siid: 3
      piid: 5
  throw: true

But how do I make a sensor from the data that I receive by this method ?

I can also do the watering of the flower with the command:

service: xiaomi_miot.set_miot_property
data:
  entity_id: sensor.ymt_v1_aff9_temperature
  siid: 2
  piid: 2
  value: true

But how do I make a Switch that returns to its original state upon completion? Since there is no parameter in the attributes that shows the watering state (true / false), thanks to which I could determine the status of the Switch, for example, through:

value_template: "{{ is_state_attr('sensor.ymt_v1_aff9_temperature', 'example: water_status', true) }}"

It is added locally, and the commands I send also work locally.

al-one commented 2 years ago

Try this service and show me notification:

service: xiaomi_miot.get_properties
data:
  entity_id: sensor.ymt_v1_aff9_temperature
  mapping:
    s3p4:
      siid: 3
      piid: 4
    s6p3:
      siid: 6
      piid: 3
    s6p4:
      siid: 6
      piid: 4
    s6p6:
      siid: 6
      piid: 6
  throw: true
bimodinochka commented 2 years ago

Try this service and show me notification:

service: xiaomi_miot.get_properties
data:
  entity_id: sensor.ymt_v1_aff9_temperature
  mapping:
    s3p4:
      siid: 3
      piid: 4
    s6p3:
      siid: 6
      piid: 3
    s6p4:
      siid: 6
      piid: 4
    s6p6:
      siid: 6
      piid: 6
  throw: true

I get this:

[{'did': 'prop.3.4', 'siid': 3, 'piid': 4, 'code': 0, 'value': 707}, {'did': 'prop.6.3', 'siid': 6, 'piid': 3, 'code': -4004}, {'did': 'prop.6.4', 'siid': 6, 'piid': 4, 'code': -4004}, {'did': 'prop.6.6', 'siid': 6, 'piid': 6, 'code': -4004}]

al-one commented 2 years ago
service: xiaomi_miot.get_properties
data:
  entity_id: sensor.ymt_v1_aff9_temperature
  mapping:
    s6p3:
      siid: 6
      piid: 3
  throw: true
service: xiaomi_miot.get_properties
data:
  entity_id: sensor.ymt_v1_aff9_temperature
  mapping:
    s6p4:
      siid: 6
      piid: 4
  throw: true
service: xiaomi_miot.get_properties
data:
  entity_id: sensor.ymt_v1_aff9_temperature
  mapping:
    s6p6:
      siid: 6
      piid: 6
  throw: true
bimodinochka commented 2 years ago

service: xiaomi_miot.get_properties data: entity_id: sensor.ymt_v1_aff9_temperature mapping: s6p4: siid: 6 piid: 4 throw: true

I get this in notifications when I request:

1: [{'did': 'prop.6.3', 'siid': 6, 'piid': 3, 'code': 0, 'value': 27}]

2: [{'did': 'prop.6.4', 'siid': 6, 'piid': 4, 'code': 0, 'value': 50}]

3: [{'did': 'prop.6.6', 'siid': 6, 'piid': 6, 'code': 0, 'value': 0}]

The value is (0) because it is dark, so it is correct.

al-one commented 2 years ago

Try this configuration:

​#​ configuration.yaml​
​xiaomi_miot​:
  ​device_customizes​:
    ymt.flowerpot.v1:
      chuck_properties: 1
bimodinochka commented 2 years ago

Try this configuration:

​#​ configuration.yaml​
​xiaomi_miot​:
  ​device_customizes​:
    ymt.flowerpot.v1:
      chuck_properties: 1

I did this:

xiaomi_miot:
  username: !secret mi_username
  password: !secret mi_password
  device_customizes:
    ymt.flowerpot.v1:
      chuck_properties: 1

Tell me what should change ?

model: ymt.flowerpot.v1
lan_ip: MY IP
mac_address: MY MAC
entity_class: MiotSensorEntity
miot_type: urn:miot-spec-v2:device:flowerpot:0000A047:ymt-v1:2
state_property: plant_monitor.temperature
plant_monitor.temperature: 27
plant_monitor.relative_humidity: 50
plant_monitor.illumination: 64
fill_light.on.error: -4004 Other internal errors
fill_light.mode.error: -4004 Other internal errors
fill_light.support.error: -4004 Other internal errors
othersetting.light.error: -4004 Other internal errors
othersetting.start_date.error: -4004 Other internal errors
othersetting.matrix.error: -4004 Other internal errors
othersetting.love_value.error: -4004 Other internal errors
othersetting.water_count: 147
othersetting.cumulative_harvest: 1
othersetting.begin_date: 1610086043
othersetting.manual_refresh: false
othersetting.report_night.error: -4004 Other internal errors
othersetting.light_low_limit.error: -4004 Other internal errors
othersetting.fill_light.error: -4004 Other internal errors
safe.safe_temperature.error: -4004 Other internal errors
safe.safe_humidity.error: -4004 Other internal errors
safe.safe_illumination.error: -4004 Other internal errors
safe.safe_fertility: 0,1579
data.fertility.error: -4004 Other internal errors
data.water.error: -4004 Other internal errors
data.water_count.error: -4004 Other internal errors
data.type.error: -4004 Other internal errors
data.type_new.error: -4004 Other internal errors
flowerpot.mode.error: -4004 Other internal errors
flowerpot.watering.error: -4004 Other internal errors
flowerpot.fault.error: -4004 Other internal errors
state_updater: lan
sub_entities: plant_monitor-6.relative_humidity-4, plant_monitor-6.illumination-6
unit_of_measurement: °C
device_class: temperature
friendly_name: Температура
supported_features: 0

Should new sensors have been added ? At the moment, everything remains the same, only 3 sensors:

1.Temperature: sensor.ymt_v1_aff9_temperature 2.Humidity: sensor.ymt_v1_aff9_relative_humidity 3.Illumination: sensor.ymt_v1_aff9_illumination

I also get an error in the Log, but it was there before all the changes:

Logger: custom_components.xiaomi_miot.sensor
Source: custom_components/xiaomi_miot/__init__.py:1298 
Integration: Xiaomi Miot Auto ([documentation](https://github.com/al-one/hass-xiaomi-miot), [issues](https://github.com/al-one/hass-xiaomi-miot/issues)) 
First occurred: 13:00:25 (2 occurrences) 
Last logged: 13:04:53

Flowerpot 2(ymt.flowerpot.v1): Got MiioException while fetching the state: {'code': -9999, 'message': 'user ack timeout'}, mapping: {'plant_monitor.temperature': {'siid': 6, 'piid': 3}, 'plant_monitor.relative_humidity': {'siid': 6, 'piid': 4}, 'plant_monitor.illumination': {'siid': 6, 'piid': 6}, 'fill_light.on': {'siid': 7, 'piid': 1}, 'fill_light.mode': {'siid': 7, 'piid': 2}, 'fill_light.support': {'siid': 7, 'piid': 3}, 'othersetting.light': {'siid': 5, 'piid': 1}, 'othersetting.start_date': {'siid': 5, 'piid': 2}, 'othersetting.matrix': {'siid': 5, 'piid': 3}, 'othersetting.love_value': {'siid': 5, 'piid': 4}, 'othersetting.water_count': {'siid': 5, 'piid': 5}, 'othersetting.cumulative_harvest': {'siid': 5, 'piid': 6}, 'othersetting.begin_date': {'siid': 5, 'piid': 7}, 'othersetting.manual_refresh': {'siid': 5, 'piid': 8}, 'othersetting.report_night': {'siid': 5, 'piid': 9}, 'othersetting.light_low_limit': {'siid': 5, 'piid': 10}, 'othersetting.fill_light': {'siid': 5, 'piid': 11}, 'safe.safe_temperature': {'siid': 4, 'piid': 1}, 'safe.safe_humidity': {'siid': 4, 'piid': 2}, 'safe.safe_illumination': {'siid': 4, 'piid': 3}, 'safe.safe_fertility': {'siid': 4, 'piid': 4}, 'data.fertility': {'siid': 3, 'piid': 4}, 'data.water': {'siid': 3, 'piid': 5}, 'data.water_count': {'siid': 3, 'piid': 6}, 'data.type': {'siid': 3, 'piid': 7}, 'data.type_new': {'siid': 3, 'piid': 8}, 'flowerpot.mode': {'siid': 2, 'piid': 1}, 'flowerpot.watering': {'siid': 2, 'piid': 2}, 'flowerpot.fault': {'siid': 2, 'piid': 3}}, max_properties: 10/29
Flowerpot 1(ymt.flowerpot.v1): Got MiioException while fetching the state: {'code': -9999, 'message': 'user ack timeout'}, mapping: {'plant_monitor.temperature': {'siid': 6, 'piid': 3}, 'plant_monitor.relative_humidity': {'siid': 6, 'piid': 4}, 'plant_monitor.illumination': {'siid': 6, 'piid': 6}, 'fill_light.on': {'siid': 7, 'piid': 1}, 'fill_light.mode': {'siid': 7, 'piid': 2}, 'fill_light.support': {'siid': 7, 'piid': 3}, 'othersetting.light': {'siid': 5, 'piid': 1}, 'othersetting.start_date': {'siid': 5, 'piid': 2}, 'othersetting.matrix': {'siid': 5, 'piid': 3}, 'othersetting.love_value': {'siid': 5, 'piid': 4}, 'othersetting.water_count': {'siid': 5, 'piid': 5}, 'othersetting.cumulative_harvest': {'siid': 5, 'piid': 6}, 'othersetting.begin_date': {'siid': 5, 'piid': 7}, 'othersetting.manual_refresh': {'siid': 5, 'piid': 8}, 'othersetting.report_night': {'siid': 5, 'piid': 9}, 'othersetting.light_low_limit': {'siid': 5, 'piid': 10}, 'othersetting.fill_light': {'siid': 5, 'piid': 11}, 'safe.safe_temperature': {'siid': 4, 'piid': 1}, 'safe.safe_humidity': {'siid': 4, 'piid': 2}, 'safe.safe_illumination': {'siid': 4, 'piid': 3}, 'safe.safe_fertility': {'siid': 4, 'piid': 4}, 'data.fertility': {'siid': 3, 'piid': 4}, 'data.water': {'siid': 3, 'piid': 5}, 'data.water_count': {'siid': 3, 'piid': 6}, 'data.type': {'siid': 3, 'piid': 7}, 'data.type_new': {'siid': 3, 'piid': 8}, 'flowerpot.mode': {'siid': 2, 'piid': 1}, 'flowerpot.watering': {'siid': 2, 'piid': 2}, 'flowerpot.fault': {'siid': 2, 'piid': 3}}, max_properties: 10/29
bimodinochka commented 2 years ago

Do I need to provide any more data ? Perhaps you can tell me how to make a sensor out of this and a button out of this?

In notifications (value) I get the water level value , but how do I make a sensor out of it ?

service: xiaomi_miot.get_properties
data:
  entity_id: sensor.ymt_v1_aff9_temperature
  mapping:
    data:
      siid: 3
      piid: 5
  throw: true

I can make a button out of this , but what should I focus on when watering is finished so that the button returns to its original state ? Maybe I should make a button without a reverse status?!

service: xiaomi_miot.set_miot_property
data:
  entity_id: sensor.ymt_v1_aff9_temperature
  siid: 2
  piid: 2
  value: true