Giter Club home page Giter Club logo

apex-ha's People

Contributors

arshergon avatar brettonw avatar itchannel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

apex-ha's Issues

Strange log error

When restarting HA:

Platform apex does not generate unique IDs. ID 10.0.5.85-apex_Leak already exists - ignoring sensor.apex_leak

Base variables are reported as a switch

I have a Kessil H80 exported through one of the base variable controllers with two variables for color and intensity. The HA integration brings these variables in as on/off switches. The Apex actually presents these as a three-way witch on/off/auto, where auto runs some script or schedule. Is there any way to bring in the actual base variable value? I see the rest interface reports these as variable types.

Discussion: should Apex switches just be OFF/AUTO?

After working with this integration for a week, I find myself having set up a variety of switches where I used an input_boolean and an input_number in pairing to configure the value of an Apex device and then to implement a switch that toggles the Apex switch between OFF and AUTO (i.e. pretty much never ON), because this feels like the desired behavior.

For example, I added an input_boolean for the heater, which I turn OFF during feeding time (because the heater and the thermometer are in different tank chambers and the heater would just turn on and run during feeding time). When I turn the input_boolean on, it sets the Apex heater switch back to AUTO, which enables the temperature program on that switch.

Maybe each HA switch could be configurable whether it turns the Apex switch on, or to auto? Maybe create two switches in the integration? Maybe it's just not a switch?

Firmware versions don't match, update doesn't work.

Home Assistant is telling me there is an upgrade for the firmware:

Installed version
5.11L_6A23
Latest version
5.11_6A23

I'm not sure where the "L" comes from in the "Installed Version" as when I check in Fusion or the device itself, it shows:

Apex Operating System
AOS Update
This Apex is currently running the latest AOS.

Installed AOS
5.11 6A23

Available AOS
5.11 6A23

If I try to do the firmware upgrade through HA, I get a generic "failed to call service". Looking in the logs after that, shows:

Logger: homeassistant.components.websocket_api.http.connection
Source: custom_components/apex/update.py:55
Integration: Home Assistant WebSocket API (documentation, issues)
First occurred: 3:54:12 PM (2 occurrences)
Last logged: 3:54:45 PM

[140308371904704] Error while updating firmware
Traceback (most recent call last):
File "/config/custom_components/apex/update.py", line 53, in async_install
await self.coordinator.apex.update_firmware()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/config/custom_components/apex/apex.py", line 190, in update_firmware
config = self.config()
^^^^^^^^^^^^^
File "/config/custom_components/apex/apex.py", line 124, in config
r = requests.get("http://" + self.deviceip + "/rest/config?_=" + str(round(time.time())), headers=headers)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/requests/api.py", line 73, in get
return request("get", url, params=params, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/requests/api.py", line 59, in request
return session.request(method=method, url=url, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 589, in request
resp = self.send(prep, **send_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/requests/sessions.py", line 703, in send
r = adapter.send(request, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/requests/adapters.py", line 486, in send
resp = conn.urlopen(
^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 714, in urlopen
httplib_response = self._make_request(
^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/urllib3/connectionpool.py", line 415, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 244, in request
super(HTTPConnection, self).request(method, url, body=body, headers=headers)
File "/usr/local/lib/python3.11/http/client.py", line 1286, in request
self.send_request(method, url, body, headers, encode_chunked)
File "/usr/local/lib/python3.11/http/client.py", line 1297, in send_request
self.putrequest(method, url, **skips)
File "/usr/local/lib/python3.11/site-packages/urllib3/connection.py", line 219, in putrequest
return HTTPConnection.putrequest(self, method, url, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/util/async
.py", line 166, in protected_loop_func
check_loop(func, strict=strict)
File "/usr/src/homeassistant/homeassistant/util/async
.py", line 153, in check_loop
raise RuntimeError(
RuntimeError: Blocking calls must be done in the executor or a separate thread; Use await hass.async_add_executor_job(); at custom_components/apex/apex.py, line 124: r = requests.get("http://" + self.deviceip + "/rest/config?
=" + str(round(time.time())), headers=headers)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/src/homeassistant/homeassistant/components/websocket_api/commands.py", line 226, in handle_call_service
await hass.services.async_call(
File "/usr/src/homeassistant/homeassistant/core.py", line 1974, in async_call
response_data = await coro
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/core.py", line 2011, in _execute_service
return await target(service_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/entity_component.py", line 235, in handle_service
return await service.entity_service_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 870, in entity_service_call
response_data = await _handle_entity_call(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/helpers/service.py", line 942, in _handle_entity_call
result = await task
^^^^^^^^^^
File "/usr/src/homeassistant/homeassistant/components/update/init.py", line 157, in async_install
await entity.async_install_with_progress(version, backup)
File "/usr/src/homeassistant/homeassistant/components/update/init.py", line 421, in async_install_with_progress
await self.async_install(version, backup)
File "/config/custom_components/apex/update.py", line 55, in async_install
raise HomeAssistantError("Error while updating firmware")
homeassistant.exceptions.HomeAssistantError: Error while updating firmware

Edit: Should have included, running HA 2023.8.0, Apex HA Version 1.13.

Failed to authenticate with Apex Controller

Hello,

I tried setting this up today but all I'm getting is a "Failed to Connect" error.

2024-01-30 09:24:12.454 ERROR (MainThread) [custom_components.apex.config_flow] Failed to authenticate with Apex Controller

Any ideas?

Entity naming is terse

Apex has very terse names that are often not descriptive enough. When importing them into HA, prefix the apex inputs/outputs with "apex_" to avoid polluting the HA namespace with these bad Apex names. For instance, Apex "Sw_1" is simply imported into HA as "switch.sw_1". It would be much easier to find the entities if it was "switch.apex_sw_1".

Read only mode

Is there a way to make this integration read only? Make it so it reads the value of sensors and switches but cannot change them? This would be a useful config option.

Rebooting Apex loses HA connection permanently

I updated the software in my Apex, and had to reboot it in the process. The HA connection was lost, and at first I thought Neptune had changed their rest API interface and broken the integration. The only way I could get it back was to remove the integration and re-add it. I subsequently rebooted the Apex again, and had the same problem. Does the login cookie need to be refreshed if an API call fails?

Measurements

Any way of pulling in the Measurements from Apex?

Integration seems to cause the Neptune to lock the local interface

I've run into this a few times - the regular logins from the integration seem to make the apex.local web interface refuse to acknowledge a login from a browser. The username and password are correct. And it will usually work again after a little while. It continues to be accessible from the cloud interface.

Screen Shot 2022-09-13 at 11 28 29 AM

Another measurement type

The new Liquid Level Sensor reports units:

{
did: "1_P3",
type: "in",
name: "LLS",
value: 5.8
},

From the "config":

mconf: [
{
abaddr: 1,
name: "module_1",
hwtype: "FMM",
update: false,
updateStat: 0,
extra: {
swapAddr: 0,
auto: [
true,
true,
false,
false
],
mode: [
"wof",
"wof",
"LLS-15",
"LLS-15"
],
flowMode: "gph",
levelMode: "in"
}
},

Without a unit on the sensor, a history graph just shows a color bar representing different values.

Mine is configured for "inches". I'm not sure if a non-US configuration will report "cm".

Combining Sensors

Is it possible to combine sensors by name to there main item?

E.G. where you have an power monitored outlet. The main outlet has sub entities of Watts, voltage, amps. Instead of being separate entities.

Would fix some integrations with energy dashboard.

More of a request...

No issue, just a request. Didn't know where else to do it.

With your work on Apex, is it possible to work with Coralvue Hydros also? Not sure what they have exposed, if anything.

Thanks...and have a better one!

FEATURE - Dosing Containers

I have the wiring mod on my DOS units. and it would be awesome to use HA to alert when my containers are getting low.

,{"status":["OFF","","OK","1900","0"],"name":"SPARE","gid":"doser_8","type":"dos","ID":31,"did":"8_1"}
,{"status":["TBL","","OK","1500","898"],"name":"TRITON_1","gid":"doser_8","type":"dos","ID":32,"did":"8_2"}
,{"status":["TBL","","OK","1500","863"],"name":"TRITON_2","gid":"doser_9","type":"dos","ID":33,"did":"9_1"}
,{"status":["TBL","","OK","2200","1644"],"name":"TRITON_3a_3b","gid":"doser_9","type":"dos","ID":34,"did":"9_2"}

They appear in the json but not in the entities. I assume as they are a type:dos.

Addition of these would be very useful.

FEATURE - Auto Mode

Is there a way to turn an item to Auto not ON. its almost like we need both options. not sure how that could work.

Sorry for the barrage of features. I'm excited!

Discussion: Controlling DOS Pumps

I have been trying to figure out how to control my DOS pump through the HA integration, and I've arrived at an intermediate hack solution that works for now, but I wonder if there's a better way.

You have two choices with the DOS. You can set it to OFF/ON, which will give you 0 or 25ml/min dosing rates. Or you can set a profile.

Unfortunately the Neptune profiles are over-constrained, so while there is some ability to set the DOS pump speed, you can't just set it to that speed and let it go. Apex will always try to manage a dose, instead of a rate. The actual dose appears to be limited to 1/3rd of the rate. I don't understand what the reasoning behind this might be. I'm curious if it's enforced at the Apex, or just in the ApexFusion UI.

In order to try to get a controlled rate, I meticulously went into ApexFusion and created 10 profiles corresponding to 1ml/min up to 10ml//min.

Screen Shot 2022-09-11 at 11 50 33 AM

Screen Shot 2022-09-11 at 11 50 16 AM

I created an input_number with a range from 0..10, and I update the profile on the Apex device with an automation like this:

input_number:
  dos_rate:
    name: "DOS rate"
    min: 0
    max: 10
    step: 1
    icon: mdi:speedometer

automation:
  - id: update_dos_rate
    alias: Update DOS Rate
    trigger:
      - platform: state
        entity_id: input_number.dos_rate
    action:
      - service: apex.set_variable
        data:
          did: "4_1"
          code: >
            {% if (trigger.to_state.state | int) == 0 %} 
            Set OFF 
            {% else %} 
            Set Dose{{ (trigger.to_state.state | int) }} 
            {% endif %}
    mode: single

I expose this on lovelace, so I have a slider:
Screen Shot 2022-09-11 at 11 53 20 AM

Consider: support some template controls from Apex

Apex has a few pre-built controls that you could explicitly support, for instance a temperature control. From the "config":

{
name: "Heater_2_4",
icon: "Thermometer",
ctype: "Heater",
log: false,
inuse: true,
type: "outlet",
did: "2_4",
gid: "",
gtype: "0",
ID: "12",
prog: "Fallback OFF 
If Tmp < 79.9 Then ON 
If Tmp > 80.1 Then OFF 
",
extra: { }
},

The heater outlet has a program attached to it, and it is specified as ctype: heater. I kind of think the point of exposing the Neptune to HA is to take control of the outlets using a richer command structure, but some stuff just doesn't need to be taken over. I can replicate the Neptune control in HA, or I could simply send a new prog value to the control with my own min/max values.

dont connect to Apex Classic

after install over HACS
add new device
user
password
ip

2022-08-17 16:40:27.462 ERROR (MainThread) [custom_components.apex.config_flow] Failed to authenticate with Apex Controller

Missing Temperature Probe Entity

At few integration updates ago the integration stopped providing the temperature probe, completely missing the entity.
I had hoped it would come back with a future update but unfortunately it has not.
I tried reinstalling the integration but it did not help.
I'm guessing I'm must've changed something as it hasn't come up as an issue for anyone else.
I do see it on the local status xml page and its formatted the same as the other probes.
Not sure if related but it is the first probe listed on the xml page.
Any help would be appreciated.
Apex 2016
Firmware 5.11 1D23

Thanks

Temperature is unitless in rest interface

The default conversion in the integration is to use degrees Celsius, but my Apex is configured for degrees Fahrenheit. Is the Apex configuration available through the rest interface to determine what the unit should be?

IOTA pump is not exposed

HA no longer has an IOTA integration, so I hoped my Sicce pump would be exposed through the Apex. It shows up in the rest interface, but I imagine that will require some custom coding to control it.

ISSUE - Status Attribute not updating

image

You can see the outlet shows off but the status attribute is not matching this. (note the status should be OFF as its hard off.

image

here Fuge is Hard on and Skimmer is Auto ON

It seems to be that the Status is not auto updating

FEATURE - Poll frequency

Firstly, I was just trying to work out this and you have just done this for me. you are awesome.

It would be great if you could control the poll interval if possible. some might want it only every x mins to remove load from the poll. I assume switches are not an issue as it calls an API to enact a switch.

Maybe its not suitible but I thought I would float the idea.

Allow apex local network name instead of ip

I haven't looked at why this fails, but the Apex registers itself on the local network as "apex". In my configuration, I can access the device using "http://apex.local".

When setting up the integration, I was not able to use the name, and had to use the IP. This is fine, but if the DHCP reservation ever changes my integration will drop. I'd prefer to use the registered name "apex.local".

REQ: Feed mode

Sorry if it's already there and I've just not seen it, but it would be absolutely awesome if the feed mode switches were available as a switch, to beable make a feedmode widget with HA

Thanks for this addon, and all the hard work you've put into it!

Total Daily Energy - Feature Request

I am wondering if it would be possible to add total daily energy sensor to the power sensors. I have not looked at the source code yet either plugins yet, but the ESPHome plugin has the ability to do this via the total_daily_energy platform. I only mention ESPHome as it is an example of how it can be done. I would like this so that I can track the energy usage of each outlet in HA.

License?

You haven't included any kind of license in your repos. What are your allowed usage terms?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.